API Docs
Authentication/Authorization
3min
How to use the POST /login endpoint to authenticate and obtain an access token:
Endpoint URL: https://yourapi.com/api/login
Request Method: POST
Request Body:
- email: The email address of the user trying to log in.
- password: The password of the user trying to log in.
- timezone: (optional) The timezone of the user trying to log in, (not required at all).
Response:
If the login is successful, the API returns a JSON response containing the following fields:
- status: The HTTP status code of the response.
- message: A message indicating whether the login was successful or not.
- data: An object containing user data like id, name, email, image, last_login and login_timezone.
- access_token: A JWT access token that can be used to authenticate subsequent requests.
- refresh_token: (optional) A JWT refresh token that can be used to obtain a new access token when the current one expires (expires every 30 days).
If the login fails, the API returns a JSON response containing the following fields:
- status: The HTTP status code of the response.
- message: A message indicating why the login failed.
Note: The access token returned by the API should be included in the Authorization header of subsequent requests, like so:
Using this token on all requests should allow the authorized user to update data within the project.