Authentication
Refresh token
Exchange a refresh token for a new access token without re-authenticating.
The Refresh Token endpoint allows you to exchange a valid refresh token for a new access token. Access tokens typically have a short lifespan, while refresh tokens remain valid longer, enabling continuous authentication without requiring the user to log in again.
Endpoint
Headers
Key | Value | Required |
---|---|---|
Content-Type | application/json | Yes |
Authorization | Bearer <refresh_token> | Yes |
Request Body
Field | Type | Description |
---|---|---|
refresh_token | string | The refresh token issued during login or token exchange. |
Response
Successful Response (200 OK)
Field | Type | Description |
---|---|---|
access_token | string | The new access token to be used in subsequent API calls. |
refresh_token | string | A new refresh token (optional, depending on implementation). |
token_type | string | Always Bearer. |
expires_in | int | Lifetime of the access token in seconds (e.g., 3600 = 1 hour). |
Error Response (400 / 401 / 403)
Error Code | Meaning |
---|---|
invalid_grant | The refresh token is expired or revoked. |
unauthorized | Missing or invalid authorization header. |
invalid_request | Required fields are missing or malformed. |
Example Usage
cURL
JavaScript (Fetch)
Info: Always keep refresh tokens secure. If a refresh token is compromised, an attacker could continuously generate new access tokens.