Skip to main content

Login Endpoint - English

Description

This endpoint allows users to authenticate using a Base64-encoded email address and an access token generated by Auth0. Once authenticated, the system generates a JWT (JSON Web Token) that is included as a parameter in the redirection URL for future authentications and secure sessions.

URL

POST /api/login

Authentication

Required Token: Auth0 access token

  • Obtaining the Token: You must register your application with Auth0 and configure it to use the authorization flow that best suits your needs (e.g., Client Credentials, Authorization Code, etc.). The access token should be requested from Auth0 using the client_id, client_secret, and the appropriate scopes that allow access to this endpoint.
  • Using the Token: The access token must be included in all requests to the login endpoint in the authorization header as a Bearer Token.

Headers

Key Value Description
Authorization Bearer {token} Auth0 access token required for authentication.

Body Parameters

Parameter Required Description
email Yes User's email address encoded in Base64.

Responses

Success Response

Code: 200 OK

Body Content:

{
  "status": "success",
  "url": "https://yourdomain.com/site/callback?token=jwt_token_here",
  "message": "User logged in"
}

Description: The response includes the operation status, a descriptive message, and a URL where the client can be redirected which includes the generated JWT.

Error Responses

Code: 401 Unauthorized

Body Content:

{
  "status": "error",
  "message": "Unauthorized or invalid token"
}

Description: Returned when the Auth0 token is invalid or has expired.

Code: 400 Bad Request

Body Content:

{
  "status": "error",
  "message": "Email is required"
}

Description: Returned when the email is not included in the request.

Response Data

Field Type Description
status string The status of the response, can be "success" or "error".
url string URL where the client can be redirected, includes the JWT in successful responses.
message string Descriptive message about the outcome of the operation.

Table of Possible Error Values

Message
"Username invalid"
"User doesn't have any licence"
"User doesn't have a profile"
"Unknown error"
"Unauthorized or invalid token"
"Email is required"

Example Usage

Request:

curl -X POST "https://yourdomain.com/api/login" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your_auth0_access_token" \
-d '{"email": "dXNlckBleGFtcGxlLmNvbQ=="}'

Response:

{
  "status": "success",
  "url": "https://yourdomain.com/site/callback?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "message": "User logged in"
}