REST API
API endpoints untuk login, register, refresh token, dan logout
POST /api/v1/auth/login Content-Type: application/json { "email": "[email protected]", "password": "your_password" }
{ "success": true, "data": { "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", "refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", "expires_in": 3600, "user": { "id": "user_123", "email": "[email protected]", "name": "John Doe", "role": "cashier" } } }
POST /api/v1/auth/register Content-Type: application/json { "email": "[email protected]", "password": "secure_password", "name": "Jane Doe", "phone": "+6281234567890" }
{ "success": true, "data": { "user_id": "user_456", "email": "[email protected]", "name": "Jane Doe" } }
POST /api/v1/auth/refresh Content-Type: application/json { "refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." }
{ "success": true, "data": { "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", "expires_in": 3600 } }
POST /api/v1/auth/logout Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
{ "success": true, "message": "Logout successful" }
GET /api/v1/auth/me Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
{ "success": true, "data": { "id": "user_123", "email": "[email protected]", "name": "John Doe", "role": "cashier", "merchant_id": "merchant_abc", "branch_id": "branch_xyz" } }
Was this page helpful?