Admin Login and Logout
This guide explains how to implement admin authentication in the Sumaya369 application.
Admin Login
Endpoint
- Method: POST
- URL:
/v1/admin/login
Request Body
| Parameter | Type | Description | Required |
|---|---|---|---|
| string | Admin's email address | Yes | |
| password | string | Admin's password | Yes |
| fcm_token | string | Firebase Cloud Messaging token | No |
| device_id | string | Unique device identifier | Required with fcm_token |
| remember_me | boolean | Keep user logged in | No |
Success Response
{
"success": true,
"message": "تم تسجيل الدخول بنجاح.",
"data": {
"first_name": "حابس",
"last_name": "ابوالحاج",
"email": "aalbaiti360@gmail.com",
"birth": "2022-01-04 08:43:02",
"phone": "966517011569",
"gender": "ذكر",
"token": "access_token_here",
"token_type": "Bearer",
"expires_at": "2023-02-23 07:00:27"
},
"status_code": 200
}
Admin Logout
Endpoint
- Method: POST
- URL:
/v1/admin/logout
Request Body
| Parameter | Type | Description | Required |
|---|---|---|---|
| device_id | string | Device identifier to remove from registered devices | No |
Success Response
{
"success": true,
"message": "تم تسجيل الخروج بنجاح.",
"data": null,
"status_code": 200
}
Example Implementation Flow
-
Login Process
- Admin enters email and password
- Application sends login request to
/v1/admin/login - Upon successful authentication:
- Receive access token
- Store admin information
- Register device if FCM token provided
- Navigate to admin dashboard
-
Logout Process
- Admin initiates logout
- Application sends logout request with token
- Clear local authentication data
- Remove device registration if device_id provided