Login
This guide explains how to implement Sign-In in the Calwe application.
Request
Endpoint
- Method: POST
- URL:
/v1/customer/login
Request Headers
| Header | Value | Required |
|---|---|---|
| Content-Type | application/json | Yes |
| Accept | application/json | Yes |
Request Body
| Parameter | Type | Description | Required |
|---|---|---|---|
| string | email address | Yes | |
| password | string | User's password | Yes |
Success Response
{
"success": true,
"message": "تم تسجيل الدخول بنجاح.",
"data": {
"firstName": "ماريا",
"lastName": "المجالي",
"email": "customer@customer.com",
"birthDate": "1931/08/13",
"phone": "966598774076",
"gender": "انثى",
"isPhoneVerified": true,
"isEmailVerified": true,
"hasCompletedProfile": true,
"token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9...",
"tokenType": "Bearer"
},
"statusCode": 200
}
Error Responses
Login Error (422)
{
"success": false,
"message": "اسم المستخدم أو كلمة المرور غير صحيحة",
"errors": [
"اسم المستخدم أو كلمة المرور غير صحيحة"
],
"data": [],
"statusCode": 401
}
Account Not Found (422)
{
"success": false,
"message": "حدث خطأ في البيانات المرسلة يرجى التحقق منها.",
"errors": {
"email": "البريد الالكتروني غير موجودً"
},
"data": [],
"statusCode": 422
}
Validation Error (422)
{
"success": false,
"message": "حدث خطأ في البيانات المرسلة يرجى التحقق منها.",
"errors": {
"password": "كلمة المرور يجب أن تحتوي على حروف وأرقام ورموز خاصة"
},
"data": [],
"statusCode": 422
}
Example Implementation Flow
- Use email and password to Sign-In in your application
- User clicks on Sign-In button