Skip to main content

Regular User Login

Authenticates a user with email and password credentials.

Authentication

No authentication required.

Request Body

email
string
required
User’s email address
password
string
required
User’s password

Response

message
string
Success message
user
object
Authenticated user information
session
object
Supabase authentication session

Error Responses

error
string
Error message
Status Codes:
  • 401 - Unauthorized (invalid credentials)
  • 500 - Internal server error

Example Request

curl -X POST https://api.vaniyk.com/api/auth/login \
  -H "Content-Type: application/json" \
  -d '{
    "email": "[email protected]",
    "password": "securePassword123"
  }'

Example Response

{
  "message": "Login successful",
  "user": {
    "id": "507f1f77bcf86cd799439011",
    "email": "[email protected]",
    "name": "John Doe"
  },
  "session": {
    "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
    "refresh_token": "v1.MRjoP7GqRGKK9Sh91...",
    "expires_in": 3600,
    "user": {
      "id": "d2f3a8b9-1c4e-5f6g-7h8i-9j0k1l2m3n4o",
      "email": "[email protected]",
      "aud": "authenticated",
      "role": "authenticated"
    }
  }
}

Usage Notes

  • Store the access_token securely in your client application
  • Include the access token in the Authorization header for subsequent API requests: Authorization: Bearer <access_token>
  • Use the refresh_token to obtain a new access token when it expires
  • The session includes both MongoDB user data and Supabase authentication data

Build docs developers (and LLMs) love