Authentication
OAuth 2.0 Flows There are 4 different OAuth 2 authenticaiton mechanism available and each with specific use case:- Device Code Authorization
- For dumb terminal authentication
- Use this when your target customer’s authentication device has limited capability
- Example includes customers with no sophisticated phones but have access to USSD or SMS
- It allows customers to authentication and give consent over dumb channels
- Authorization Code Flow
- For smart terminals
- Use this for web applications where ther eis a backend that can exchange the generated
authorisation codefor a token - Bakend can securle store your cleint id and client secret away from the web browser
- Authorization Code Flow with PKCE (Proof Key for Code Exchange)
- For browser/untrusted applications e.g. Single Page Application
- Use this when you are developing a single page application (SPA) for enhanced security
- Client Credentials
- Use this when calling API that does not require Customer consent
- Example includes APIs like:
Open new Account,Get Biller Categoryies,Get Billersetc
API Authentication
After obtaining your acess token via the OAuth 2 flow described earlier, use the obtained acess token to access the APIs. All API calls require:- Authorization:
Bearer <access_token>- OAuth 2.0 access token - signature:
<signature>- Request signature for security - idempotency_key:
<idempotency_key>- Unique identifier for request deduplication
Authorization Endpoint
Request
Parameters
Example Request
Token Endpoint
Request
Parameters
Example Request
Response
PKCE Implementation
PKCE (Proof Key for Code Exchange) adds an extra layer of security to the OAuth flow. Here’s how to implement it:Available Scopes
Using Access Tokens
Once you have an access token, include it in theAuthorization header for all API requests:
Token Refresh
Access tokens expire after 1 hour. Use the refresh token to get a new access token:Security Best Practices
1. Secure Storage
- Store client secrets server-side only
- Use environment variables for sensitive data
- Never expose credentials in client-side code
2. Token Management
- Store access tokens securely
- Implement automatic token refresh
- Clear tokens on logout
3. PKCE Implementation
- Always use PKCE for web applications
- Generate cryptographically secure random values
- Store code verifier securely during the flow
4. Redirect URI Validation
- Use exact redirect URI matching
- Avoid wildcard redirect URIs
- Validate redirect URIs server-side
5. State Parameter
- Always include a random state parameter
- Validate state parameter on callback
- Use cryptographically secure random values
Error Handling
Common OAuth errors and how to handle them:Always implement proper error handling and provide clear feedback to users when authentication fails.
Testing Authentication
Use our sandbox environment to test your authentication implementation:- Register your application in sandbox
- Test the complete OAuth flow
- Verify token exchange and API calls
- Test error scenarios and edge cases