Skip to main content

Login Endpoint - English

API Documentation - Login Endpoint

Description

This endpoint allowsauthenticates users toby authenticatevalidating usingan Auth0 access token and a Base64-encoded emailemail. addressIf andauthentication anis accesssuccessful, token generated by Auth0. Once authenticated, the systemit generates a JWT (JSONfor Webthe Token)user thatsession. If the provided Auth0 token is includedexpired asor invalid, the user will be redirected to a parameterspecified in the redirection URL for future authentications and secure sessions.URL.

URL

POST 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 TypeDescription
email Yes User'stringThe user's email address encoded in Base64.Base64 format.
redirect_urlNostringURL to which the user will be redirected if the Auth0 token is expired or invalid.

ResponsesRequest Example

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

Success Response

Code: 200 OK

Body Content:

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

Description: The response includes the operationstatus status,of the operation, a descriptive message, and a URL where the client can be redirected which includeswith the generated JWT.JWT as a parameter for user redirection.

Error Responses

  • Code: 401 Unauthorized

    Body(with Contentredirect_url provided):

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

Description: Returned whenIf the Auth0 token is invalid or has expired.expired, and a redirect_url is provided, the user is redirected to that URL.

  • Code: 400 Bad Request

    Body(Email Contentmissing):

{
  "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.
tokenstringThe JWT generated for the user session.
expires_inintToken expiration time in seconds.
message string Descriptive message about the outcome of the operation.

Table of Possible Error Values

invalid" unspecified
CodeMessageDescription
"Username401 Unauthorized or invalid tokenIndicates that the provided Auth0 token is invalid or expired. If redirect_url is provided, the user is redirected.
"400Email is requiredEmail was not provided in the request body.
400Username invalidThe username does not exist in the system.
400User doesn't have any licence"licenceThe user lacks the necessary licensing.
"400User doesn't have a profile"profileThe user does not have an associated profile.
"400Unknown error"error
An
"Unauthorizederror or invalid token"
"Email is required"occurred.

Example

This Usage

documentation

Request:now accurately reflects the behavior of the endpoint when dealing with expired or invalid Auth0 tokens, including the redirection to a specified URL if provided. This ensures a clear and comprehensive understanding for all potential users and developers interacting with the API.

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"
}