Back to API List
Authentication API
Simplified API for user authentication processes like login, logout, and status check.
Security
Internal API - Hosted by this App
API Endpoints & Usage
Explore and interact with the available endpoints for the Authentication API. These API routes are live! The paths shown below are relative to your application's base URL. For example, if this application is hosted at
https://gen-endpoint.com
, an endpoint path for this API, such as /api/auth/login
, would be accessible at https://gen-endpoint.com/api/auth/login
. You can use the "Try it out" section for each endpoint or use tools like curl
, Postman, or your browser's address bar (for GET requests) to interact with them.POST
/api/auth/login
Authenticates a user and returns a session token.
Show Static Examples
Example Request Body:
{
"email": "alice@example.com",
"password": "securepassword123"
}
Example Response:
{
"message": "Login successful.",
"user": {
"id": "usr_1",
"name": "Alice Wonderland",
"email": "alice@example.com",
"role": "admin"
},
"token": "mock_jwt_token_string_12345",
"expiresAt": "2024-08-17T10:00:00Z"
}
Try it out
POST
/api/auth/logout
Logs out the current user and invalidates their session.
Show Static Examples
Example Response:
{
"message": "Logout successful.",
"timestamp": "2024-08-16T17:00:00Z"
}
Try it out
GET
/api/auth/status
Checks the current authentication status of the user.
Show Static Examples
Example Response:
{
"isAuthenticated": true,
"user": {
"id": "usr_1",
"name": "Alice Wonderland",
"email": "alice@example.com",
"role": "admin"
},
"checkedAt": "2024-08-16T17:05:00Z"
}
Try it out
You can add or change query parameters in the path above (e.g., ?name=User).