Receives a Firebase ID token in the Authorization header (Bearer token). Verifies the token, checks if the user exists in the database based on Firebase UID. If the user exists, returns user data and a JWT for subsequent API calls. If the user doesn't exist, it implicitly creates the user based on the token and returns the new user data and a JWT.
POST
/auth
curl \
--request POST 'https://referspecs-backend.onrender.com/api/v1/auth'
Response examples (200)
{
"success": true,
"statusCode": 200,
"message": "Authentication successful",
"data": {
"user": {
"id": "string",
"email": "hello@example.com",
"role": "user",
"name": "string",
"address": "string",
"picture": "string",
"user_id": "string",
"verified": true
},
"token": "string"
}
}
Response examples (201)
{
"success": true,
"statusCode": 200,
"message": "Authentication successful",
"data": {
"user": {
"id": "string",
"email": "hello@example.com",
"role": "user",
"name": "string",
"address": "string",
"picture": "string",
"user_id": "string",
"verified": true
},
"token": "string"
}
}
Response examples (401)
{
"success": false,
"statusCode": 400,
"message": "Error description"
}
Response examples (404)
{
"success": false,
"statusCode": 400,
"message": "Error description"
}
Response examples (500)
{
"success": false,
"statusCode": 400,
"message": "Error description"
}