Authentication
This guide explains how to securely and efficiently authenticate Caf SDKs.
Integration overview
Obtain access credentials (Mobile Key)
Generate the Authentication Token (JWT signed with your
client-secret)Exchange this token for a Mobile Token (Session Token)
Use the Mobile Token when initializing the SDK
For clients using Caf SDKs who subsequently create transactions to perform additional validations, you will have an additional step: link the Mobile Token to a transaction, sending it as a referenceToken in the creation request to allow complete tracking of the user journey. Check out Transaction linking for more details.
1. Obtain access credentials (Mobile Key)
Mobile Keys are used to sign and authenticate requests.
How to obtain:
Go to the Trust Platform
Navigate to Settings → API configurations (Mobile Keys "tab")
Copy an existing key or create a new one, specifying the products and key name.
2. Generate Authentication Token (JWT)
This JWT is generated on your server and signed with the Mobile Key's client-secret.
Payload fields:
iss
Yes
Your client-id (provided by CAF)
exp
No
Token expiration (Unix timestamp)
Example payload:
This JWT must be signed with the Mobile Key's client-secret.
3. Exchange Authentication Token for Mobile Token
After generating the JWT, you must exchange it for the Mobile Token, which will be used to initialize the SDK. For each SDK session in your application, generate a Mobile Token using the previously created Authentication Token.
Returns a JWT token enriched with a unique session identifier.
Authentication Token (JWT) signed with your client-secret
JWT generated with session details
123e4567-e89b-12d3-a456-426614174000eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...Invalid or missing token
Internal server error
GET /bff/session-tokens HTTP/1.1
Host: web.us.prd.caf.io
Authorization: YOUR_AUTHENTICATION_TOKEN
{
"requestId": "123e4567-e89b-12d3-a456-426614174000",
"sessionToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}4. Use the Mobile Token in the SDK
The mobile-token (Session Token) is used during SDK initialization and ensures that each session is securely authenticated and traceable.
Below is how to integrate it on different platforms:
4.1 Android
Check out Android SDK Integration for more details.
Check out Android Certta SDK Installation Guide for more details.
4.2 iOS
Check out iOS SDK Integration for more details.
Check out iOS SDK Integration for more details.
4.3 Web
Check out Web SDK Integration for more details.
Transaction linking
To ensure the security and complete traceability of the user journey, each transaction created via the API must be linked to the original session generated by the SDK. This link is made by including the Mobile Token (session token) in your calls, creating a unified audit trail.
Best practices for token-based authentication
To ensure a secure and reliable integration when using token-based authentication with our service, follow these recommended practices and avoid common pitfalls.
✅ Recommended practices
Generate and sign tokens on the server
Always issue JWTs from your trusted backend system to avoid exposing signing keys.
Exchange the JWT at the /session-tokens endpoint before initializing the SDK
Use the /session-tokens endpoint to exchange the signed JWT and obtain a short-lived session token before starting the SDK.
Use short expiration times for JWTs
Limit token lifetime to reduce the impact of potential exposure or misuse.
Validate SDK responses on the backend using the client-secret
Perform server-side validation of SDK responses to ensure authenticity and integrity of the data.
❌ Unsafe practices
Generating tokens on the frontend
Exposes your signing keys and compromises the entire authentication system.
Storing signing keys or secrets in frontend/mobile apps
Secrets in client-side code can be extracted and misused.
Hardcoding secrets in version-controlled code
Secrets in code repositories can be leaked or accessed by unauthorized users.
Reusing long-lived tokens across multiple sessions
Increases the risk and blast radius in case a token is exposed or compromised.
Important Notice on Authentication and Integrations
All integrations with Caf APIs must be implemented exclusively via backend/server-side. Client-side or frontend-based integrations may be blocked and significantly increase the risk of authentication key exposure.
Caf continuously monitors the usage and exposure of authentication keys. Any key identified as exposed, compromised, or used in non-compliant implementations will be immediately revoked, which may result in the interruption of the associated operation, without prior notice.
It is the integrator’s responsibility to ensure compliance with the recommended authentication patterns and security best practices described in this documentation.
Last updated

