Authentication
To access protected resources, use the Login API to authenticate users and retrieve a token.
POST
baseUrl/api/v1/auth/loginHeaders
Content-Type: application/json
- Parameters
- Response
Send a JSON object with the following fields:
| Field | Type | Required | Description |
|---|---|---|---|
username | string | Yes | The unique username of the cashier setup during the onboarding step. Or the email of the merchant account can be used here as well to login as a Merchant. |
password | string | Yes | The corresponding 8 character long password. |
Example Request
{
"username": "cashierUsername",
"password": "password"
}
{
"username": "merchant@email.com",
"password": "password"
}
A successful response returns a JSON object containing an access token. This token must be included in the Authorization header for subsequent requests to protected resources.
Key Attributes
| Field | Type | Description |
|---|---|---|
| accessToken | string | The access token for authentication. |
| role | string | The role of the user in the system. E.g: CASHIER, MERCHANT, FINANCE |
| fullName | string | The full name of the user set during the onboarding process |
| string | The email of the user set during the onboarding process |
Example Response
{ "accessToken": "19bPsb8eZ-i6TUwW5T9tJsXrUMoN1s9hBBESdnM9m-0",
"role": "CASHIER", "fullName": "name", "email": "email" }
Usage Tips
- Keep Your Token Secure: Never expose the
accessTokenin client-side code or logs. - Token Expiry: The token expires after 24 hours. If your token expires, re-authenticate to obtain a new one.
- Include the Token in Requests: Use the format
Authorization: Bearer <accessToken>in the header when accessing protected resources.