Authentication
Authenticate user
Obtain an access token to authenticate a user and start a new session.
The Authenticate User endpoint verifies a user’s credentials and issues new access and refresh tokens. Use this endpoint when a user logs in with their username/email and password.
Endpoint
Headers
Key | Value | Required |
---|---|---|
Content-Type | application/json | Yes |
Request Body
Field | Type | Description |
---|---|---|
string | The user’s email address or username. | |
password | string | The user’s password (plaintext). |
Response
Successful Response (200 OK)
Field | Type | Description |
---|---|---|
access_token | string | Token to be used in API requests. |
refresh_token | string | Token to obtain new access tokens when expired. |
token_type | string | Always Bearer. |
expires_in | int | Token lifetime in seconds. |
user | object | Basic user profile information. |
Error Response (401 / 400)
Error Code | Meaning |
---|---|
invalid_credentials | Incorrect email or password. |
unauthorized | Authentication failed. |
invalid_request | Missing or malformed fields. |
Example Usage
cURL
JavaScript (Fetch)
For best security practices, always transmit login requests over HTTPS, and never log user passwords.