Skip to main content

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

ParameterTypeDescriptionRequired
emailstringAdmin's email addressYes
passwordstringAdmin's passwordYes
fcm_tokenstringFirebase Cloud Messaging tokenNo
device_idstringUnique device identifierRequired with fcm_token
remember_mebooleanKeep user logged inNo

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

ParameterTypeDescriptionRequired
device_idstringDevice identifier to remove from registered devicesNo

Success Response

{
"success": true,
"message": "تم تسجيل الخروج بنجاح.",
"data": null,
"status_code": 200
}

Example Implementation Flow

  1. 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
  2. Logout Process

    • Admin initiates logout
    • Application sends logout request with token
    • Clear local authentication data
    • Remove device registration if device_id provided