Authentication
Most IZI Pay API calls use bearer token authentication.
Authentication Workflow
Follow the steps below to generate an access token and access protected API endpoints securely.
-
Request an Access Token
Start by calling POST /connect/token to authenticate your application and request an access token.
Include the required credentials and grant type in the request body.
Example request:
httpExample response:
jsonNotes
- Store the access token securely.
- Never expose client secrets in frontend applications.
- Tokens are typically time-limited and may require renewal after expiration.
- Use environment variables or a secure secrets manager for credentials.
-
Store and Manage the Token
After receiving the token:
- Save it securely in memory, server-side storage, or a secure token cache.
- Track the
expires_invalue to know when the token must be refreshed. - Implement retry and refresh logic for expired or invalid tokens.
- Avoid logging sensitive authentication values in production environments.
Recommended practices:
- Use HTTPS for all authentication requests.
- Rotate client credentials periodically.
- Restrict token scope and permissions whenever possible.
-
Authorize Protected API Requests
Send the access token on all protected requests using the
Authorizationheader.Example:
httpExample protected request:
httpCommon authentication responses:
401 Unauthorized→ Missing, expired, or invalid token403 Forbidden→ Token does not have sufficient permissions
Best practices:
- Validate authentication failures gracefully.
- Implement centralized authorization handling in your API client.
- Avoid hardcoding tokens directly into source code.
-
Test and Validate Authentication
Before deploying:
- Verify token generation succeeds in all environments.
- Confirm protected endpoints accept valid bearer tokens.
- Test expired token handling and refresh behavior.
- Validate error responses for invalid credentials and unauthorized access.
- Ensure secrets are properly configured in CI/CD and deployment pipelines.
Recommended checks:
- Authentication requests use HTTPS only
- Tokens are not exposed in logs or browser storage
- Unauthorized requests return expected error codes
- API permissions and scopes behave correctly
text
Use client credentials for server-to-server flows. Use the password login flow only for trusted applications that are allowed to collect user credentials.
Browser requests and CORS
Token requests that include client secrets should be made from your backend, a secure server-side proxy, or tools such as Postman. Browser calls from https://developer.izipay.ao to https://pay.izipay.ao/connect/token require the API host to return CORS headers for the docs origin.
Token Handling
Treat access tokens, refresh tokens, client IDs, and client secrets as sensitive values.
Do not expose secrets in browser code, mobile app bundles, logs, or public repositories.