Authentication API
Authentication endpoints for the Redirect Manager API
Learn how to login, logout, and manage your session tokens.
/api/v1/auth/login
Login
Authenticate with username and password to receive a JWT access token and a refresh token (via cookie).
Request Body
Provide your credentials to obtain an authentication token.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
username | string | Required | User username for authentication Example: |
password | string | Required | User password for authentication Example: |
Example:
{
"username": "admin",
"password": "your_secure_password"
}Response Status Codes
Possible response codes for the login endpoint.
Login successful. Returns JWT access token. Sets 'refreshToken' as an HttpOnly cookie.
Example Response:
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"token_type": "Bearer",
"expires_in": 3600
}Unauthorized. Invalid username or password.
Example Response:
{
"error": {
"message": "Invalid credentials"
}
}/api/v1/auth/logout
Logout
Invalidate the current session and clear authentication cookies.
Request Headers
Provide your bearer token to logout. The refresh token cookie must also be present.
Request Headers:
| Header | Type | Required | Description |
|---|---|---|---|
Authorization | string | Required | Bearer token for authentication Example: |
Example:
{
"Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}Request Body
Optional parameters for logout.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
allDevices | boolean | Optional | If true, logs out from all devices by invalidating all refresh tokens for the user. Example: |
Example:
{
"allDevices": false
}Response Status Codes
Possible response codes for the logout endpoint.
Logout successful. Clears 'refreshToken' cookie. No response body.
Unauthorized. No token provided or invalid token.
Example Response:
{
"error": {
"message": "No jwt token provided"
}
}/api/v1/auth/refresh
Refresh Token
Issue a new JWT access token and rotate the refresh token using the existing refresh token cookie.
Cookie Requirements
This endpoint requires the refreshToken cookie to be present in the request.
Response Status Codes
Possible response codes for the refresh token endpoint.
Token refreshed successfully. Returns new JWT access token. Also updates the 'refreshToken' cookie.
Example Response:
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"token_type": "Bearer",
"expires_in": 3600
}Unauthorized. No refresh token provided or token is invalid/expired.
Example Response:
{
"error": {
"message": "No refresh token provided"
}
}