Skip to main content

Overview

The FLEX SSO API uses OAuth 2.0 Authorization Code Flow to securely authenticate customers and grant access to their wallets. This flow ensures that customer credentials never pass through your servers.

Authentication Flow

1

Customer Login

User provides PayTag and password
2

Request Auth Code

Your backend calls /sso/auth-code to get authorization code
3

Redirect Customer

Redirect user to the returned URL containing the auth code
4

Exchange for Token

Extract auth code from redirect and exchange it for a customer JWT token
5

Make Authenticated Requests

Use the JWT token in the Authorization: Bearer header for all wallet operations

Required Headers

For Partner-Only Endpoints

These endpoints only require partner credentials (PayTag creation, auth flow):
string
required
Your partner client identifier
string
required
Your partner API key

For Customer-Authenticated Endpoints

These endpoints require both partner credentials AND customer token (wallet operations):
string
required
Your partner client identifier
string
required
Your partner API key
string
required
Customer JWT token in format: Bearer {token}

Step 1: Request Authorization Code

When a customer wants to log in, send their credentials to get an authorization code.
Response: A redirect URL containing the authorization code
The redirect URL is configured during partner onboarding. Contact support to set or update your redirect URLs.

Step 2: Exchange Auth Code for Token

After redirecting the customer and receiving the auth code in your callback endpoint, exchange it for a JWT token.
Response: A JWT token for the authenticated customer
Store the customer token securely! Never expose it in client-side JavaScript or logs. Use server-side sessions or encrypted cookies.

Step 3: Make Authenticated Requests

Use the customer token to access wallet features:

Complete Implementation Example

Here’s a complete OAuth flow implementation:

Token Management

Token Lifecycle

  • Expiration: Customer tokens have a limited lifespan (check with support for exact duration)
  • Refresh: Currently, tokens must be re-obtained through the auth flow
  • Storage: Store securely server-side, never in client-side storage

Best Practices

Use HTTPS only - Never transmit tokens over unencrypted connections
Server-side storage - Store tokens in encrypted server-side sessions
Token validation - Check for 401 errors and prompt re-authentication
Logout handling - Clear tokens from session when user logs out

Error Responses

Cause: Invalid credentials or expired/invalid tokenSolution:
  • For auth-code: Verify customer PayTag and password are correct
  • For token exchange: Verify auth code is valid and not expired
  • For authenticated requests: Token may be expired, prompt re-login
Cause: Missing or invalid parametersSolution: Check that all required fields are included and properly formatted
Cause: Customer PayTag doesn’t existSolution: Guide user to create a PayTag using the PayTag creation flow

Security Considerations

Never store passwords! The OAuth flow ensures passwords never hit your database. Only store the customer token.

Use Environment Variables

Store partner credentials in environment variables

Implement Rate Limiting

Prevent brute force attacks on login endpoints

Log Security Events

Monitor failed authentication attempts

HTTPS Required

Always use HTTPS in production

Next Steps

PayTag Creation

Learn how to create new customer accounts

Integration Guide

Build complete wallet features

Wallet API

Explore wallet management endpoints

Transactions API

Process payments and transfers

API Reference

OAuth Flow Endpoints

Get Authorization Code

POST /sso/auth-code - Authenticate customer and get authorization code

Exchange Token

GET /sso/token - Exchange authorization code for customer JWT token

PayTag Creation Endpoints

Verify PayTag

GET /sso/verify-tag - Check if a PayTag is available

Initiate Creation

POST /sso/create-tag - Start PayTag creation with BVN verification

Send OTP

GET /sso/{session}/otp - Send OTP for verification

Validate OTP

POST /sso/{session}/otp - Validate OTP code

Complete Creation

POST /sso/create-tag/{session}/complete - Create PayTag

Get Session

GET /sso - Get PayTag creation session payload

Required Headers

Partner Authentication (PayTag Creation):
  • x-client-id: Your partner ID
  • x-api-key: Your partner API key
Customer Authentication (Wallet Operations):
  • x-client-id: Your partner ID
  • x-api-key: Your partner API key
  • Authorization: Bearer {customer_token}
Complete API Specification: View the full SSO OpenAPI Spec for detailed schemas and all endpoint specifications.