Skip to main content
POST
OAuth2 token endpoint supporting password grant (login) and refresh token grant. This endpoint authenticates users and returns access tokens for API access.

Password Grant (Login)

Authenticate a user with email/phone and password to receive access and refresh tokens.

Query Parameters

string
required
The OAuth2 grant type. Use password for login or refresh_token for token refresh.

Request Body (Password Grant)

string
User’s email address. Either email or phone is required.
string
User’s phone number in international format. Either email or phone is required.
string
required
User’s password.

Refresh Token Grant

Use a refresh token to obtain new access tokens without re-authentication.

Request Body (Refresh Token Grant)

string
required
The refresh token obtained from a previous authentication.

Response

string
JWT access token for authenticating API requests
string
Token type, always “bearer”
integer
Token expiration time in seconds (typically 3600 for 1 hour)
integer
Token expiration timestamp (Unix timestamp)
string
Refresh token for obtaining new access tokens
object
User information object

Error Responses

Using Access Tokens

Include the access token in the Authorization header for authenticated requests:
Example authenticated request:

Token Refresh Strategy

Implement automatic token refresh in your application:

Phone Number Login

To login with a phone number instead of email:

Rate Limiting

This endpoint is rate limited to prevent brute force attacks:
  • Password Grant: 5 attempts per minute per IP address
  • Refresh Token Grant: 10 requests per minute per user

Security Features

  • Secure Password Hashing: Passwords are verified using bcrypt
  • Token Rotation: Refresh tokens are rotated on each use
  • Rate Limiting: Protection against brute force attacks
  • Audit Logging: All authentication attempts are logged

Next Steps

After successful authentication:
  1. Store tokens securely - Save access and refresh tokens
  2. Make authenticated requests - Use the access token in API calls
  3. Handle token expiration - Implement automatic refresh logic
  4. Implement logout - Use the logout endpoint