Short-Lived Client Tokens

Generate a short-lived client token bound to a journey before initializing the IDWise SDK.

Start a journey on your backend, generate a short-lived client token bound to that journey, then initialize and resume the journey in the SDK.

What is a client token?

A client token is a time-limited credential that you can use instead of a permanent client API key when starting a journey in the SDK. Your backend generates the token through the /v2/generate-client-token API.

Set the token lifetime with expires_in, in seconds. The value must be between 300 and 3,600 seconds.

When you send journey_id, IDWise binds the generated token to that specific journey. The SDK can use the token only for that journey until the token expires. If you leave journey_id empty, the token can be used across journeys until it expires.

Generate, initialize, and resume a journey

  1. Start the journey on your backend. Call the Start Journey API with the appropriate flow_id. Store the journey_id returned in journey_summary.
  2. Generate the client token after the journey starts. Call the generate-client-token API from your backend. Send the returned journey_id in the journey_id parameter, along with your selected expires_in value.
  3. Return the token to your client application. Return only the short-lived client_token and the journey information required to initialize the SDK. Do not expose your permanent API credentials to the client.
  4. Initialize the SDK for the journey. Use the client token to initialize the SDK for the journey that your backend created.
  5. Resume the journey after initialization. Resume the bound journey in the SDK by using the returned journey_id.
sequenceDiagram
    actor User as End user
    participant App as Your app (frontend)
    participant SDK as IDWise SDK
    participant Backend as Your backend
    participant IDWise as IDWise backend

    User->>App: Click Start Verification
    App->>Backend: Request a session client token
    Backend->>IDWise: POST /v2/start-journey
    IDWise-->>Backend: Return journey_id
    Note over Backend: Use the journey_id returned by Start Journey
    Backend->>IDWise: POST /v2/generate-client-token\nwith journey_id
    Note right of Backend: Authenticate with your server API key
    IDWise-->>Backend: Return client_token
    Backend-->>App: Send client_token and journey_id
    App->>SDK: Initialize with client_token
    App->>SDK: Resume journey with journey_id
    Note over SDK: The SDK resumes the bound journey

Did this page help you?