Google Login
This guide explains how to implement Google Sign-In in the Calwe application.
Request
Endpoint
- Method: GET
- URL:
/v1/customer/auth/google/callback
Request Headers
| Header | Value | Required |
|---|---|---|
| Content-Type | application/json | Yes |
| Accept | application/json | Yes |
Request Body
{
"google_id": "google_id",
"fcm_token": "firebase_cloud_messaging_token",
"device_id": "unique_device_identifier"
}
| Parameter | Type | Required | Description |
|---|---|---|---|
| google_id | string | Yes | The ID token obtained from Google Sign-In |
| fcm_token | string | No | Firebase Cloud Messaging token for push notifications |
| device_id | string | Required with fcm_token | Unique identifier for the device |
Success Response
{
"success": true,
"message": "تم تسجيل الدخول بنجاح.",
"data": {
"firstName": "Ahmed",
"lastName": "Mohammed",
"email": "example@gmail.com",
"birthDate": "1990/01/01",
"phone": null,
"gender": "ذكر",
"isPhoneVerified": false,
"isEmailVerified": true,
"hasCompletedProfile": false,
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9....",
"tokenType": "Bearer"
},
"statusCode": 202
}
Example Implementation Flow
- Initialize Google Sign-In in your application
- User clicks on Google Sign-In button
- Obtain Google ID token after successful sign-in
- Send token to
/v1/customer/auth/google/callbackendpoint - Handle the response and store the API token