Authentication
Token-Based Authentication
Login: Use the /auth/login endpoint to authenticate with email and password (base64-encoded) to receive X-Access-Token and X-Refresh-Token.
Refresh Tokens: Use /auth/refresh/token with the X-Refresh-Token to obtain new access tokens.
Logout: Invalidate tokens via /auth/logout.
Headers:
X-Access-Token: Required for authenticated requests.
X-Refresh-Token: Used for token refresh.
Example: X-Access-Token: {{access-token}}
Sample Login Request
{
"email": "bWVyY2hhbnQxQG1haWxpbmF0b3IuY29t",
"password": "cGFzc3dvcmQ="
}Sample Response
{
"status": true,
"data": {
"id": "425bc461-9b6c-4036-b47a-9d96e4f21eba",
"role": "USER",
"email": "merchant1@mailinator.com",
"lastName": "Obagunwa",
"firstName": "Samson",
"createdAt": "2021-08-16T22:59:27.026Z",
"updatedAt": "2022-05-03T11:01:11.923Z"
},
"merchant": {
"email": "merchant1@mailinator.com",
"id": "e84a4677-3158-40ba-8967-f523c2315cf9",
"lastName": "Obagunwa",
"mode": "SANDBOX",
"role": "Admin",
"firstName": "Samson",
"owner": false,
"review": "PENDING",
"businessName": "Caleb",
"businessType": "Restaurants",
"createdAt": "2022-05-03T10:18:19.172Z",
"updatedAt": "2022-05-03T10:18:19.172Z"
}
}Headers include X-Access-Token and X-Refresh-Token for subsequent requests.
API Endpoints
Authentication
Login
Endpoint: {{base-url}}/auth/login
Method: POST
Description: Authenticate a merchant and receive access and refresh tokens.
Request Body:
Response: 200 OK with token headers and user/merchant data (see above).
Logout
Endpoint: {{base-url}}/auth/logout
Method: POST
Description: Invalidate the current session tokens.
Headers:
X-Access-Token: {{access-token}}
X-Refresh-Token: {{refresh-token}}
Response: 200 OK (no body).
Forget Password
Endpoint: {{base-url}}/auth/password/forget
Method: POST
Description: Request a password reset code via email.
Request Body:
Response: 200 OK
Reset Password
Endpoint: {{base-url}}/auth/password/reset
Method: POST
Description: Reset the password using a reset code.
Request Body:
Response: 200 OK
Refresh Tokens
Endpoint: {{base-url}}/auth/refresh/token
Method: POST
Description: Refresh access tokens using a valid refresh token.
Headers: X-Refresh-Token: Cx9AH9ubWqG3JyBz8DZr-E6aTa8GKruNerzJRCDUFbyjM6ef
Response: 200 OK with new X-Access-Token and X-Refresh-Token.
HTTP Method: POST
Headers:
Accept: application/json
Content-Type: application/json
Request Parameters (JSON):
Sample Implementation
The above command returns JSON structured like this:
Last updated