JWT Authentication
v1.1.0Built-in authentication powered by php-open-source-saver/jwt-auth.
Authentication Flow
text
Login
│
▼
JWT Token
│
▼
Bearer Authorization
│
▼
Protected RoutesAvailable Endpoints
| Method | Endpoint |
|---|---|
| POST | /api/auth/login |
| GET | /api/auth/me |
| POST | /api/auth/refresh |
| POST | /api/auth/logout |
Login
POST/api/auth/loginRequest:
json
{
"email": "john@example.com",
"password": "secret"
}Successful response:
json
{
"type": "success",
"status": 200,
"data": {
"access_token": "...",
"token_type": "Bearer",
"expires_in": 3600
}
}Use the returned token in the Authorization: Bearer header.
Current User
GET/api/auth/meHeaders:
text
Authorization: Bearer YOUR_TOKENResponse:
json
{
"name": "John Doe",
"email": "john@example.com"
}Refresh Token
POST/api/auth/refreshReturns a new JWT without requiring another login.
Logout
POST/api/auth/logoutInvalidates the current token.