Login Api
Login Authentication
Description :
This API endpoint is used for user authentication during login. It validates the provided credentials and handles various scenarios such as account status, mobile verification, email verification, and login history.
Endpoint URL :Request Parameters
| Request Parameter | Data Type | Default Value | Required | Description | Change Date | Change Description |
|---|---|---|---|---|---|---|
| username | string | Yes | The user's username or mobile number | |||
| password | string | Yes | The user's password | |||
| latitude | float | Yes | The latitude of the user's location | |||
| longitude | float | Yes | The longitude of the user's location |
Request Example
Responses (JSON)
- Status Code 1: Login Success
- Description: Successful login with valid credentials.
- 'status_code' (integer): 1
- 'message' (string): "Login Successful"
- 'url' (string): The URL to redirect the user to after successful login (e.g., 'admin-dashboard' or 'dashboard').
- 'app_access_token' (string): for authorization of api access.
- 'refresh_token' (string): used to generate new app_access_token token.
{"status_code": 2, "message": "Username is required"}
- Status Code 2: Validation Error
- Description: Validation error in the input parameters.
- 'status_code' (integer): 2
- 'message' (string): "A specific validation error message."
{"status_code": 0, "message": "Invalid username or password"}
- Status Code 0: Error message
- Description: A specific error message.
- 'status_code' (integer): 0
- 'message' (string): "Invalid username or password."
{"status_code": 3, "message": "Mobile Verification Required"}
- Status Code 3: Mobile Verification Required
- Description: The user's mobile number requires verification, redirect user to otp enter screen.
- 'status_code' (integer): 3
- 'message' (string): "Mobile Verification Required."
{"status_code": 4, "message": "Email Address Verification Required", "email": "test@gmail.com"}
- Status Code 4: Email Verification Required
- Description: The user's email address requires verification, redirect user to otp enter screen.
- 'status_code' (integer): 4
- 'message' (string): "Email Address Verification Required."
- 'email' (string): The user's email address.
{"status_code": 5, "message": "Login Verification Required"}
- Status Code 5: Login Verification Required
- Description: Additional login verification is required (e.g., two-factor authentication). redirect user to otp enter screen.
- 'status_code' (integer): 5
- 'message' (string): "Login Verification Required."
Note
- The API endpoint should be accessed via a POST request.
- Ensure that the request is properly validated and sanitized to prevent security vulnerabilities.
- Implement proper error handling on the client side to display user-friendly error messages based on the 'status_code' and 'message' fields in the response.