Skip to main content
The SDK authenticates each session with a short-lived launch token. You mint this token on your secure backend and hand it to the client through the fetchClientSecrets callback.
Never expose your client ID or client secret to the frontend, and never mint launch tokens in the browser. Always retrieve them from a backend you control.

How it fits together

1

Your frontend asks your backend for credentials

The SDK calls your fetchClientSecrets function, which hits a route on your own server.
2

Your backend calls the TORTUS launch endpoint

Authenticated with your client ID and secret, your server requests a launch token.
3

Your backend returns the launch token

The SDK exchanges the token to load and authenticate the embedded app.

The launch endpoint

Authenticate with HTTP Basic Authentication using your TORTUS-provided credentials: Base64-encode clientId:clientSecret and send it in the Authorization header.

Request body

All fields are optional. Send what’s relevant to your integration.
string
To help identify and resume the correct user, send their first and last name on every launch. After their first launch, also send the returned userId. Include any other fields relevant to your integration.
If you don’t send userId for someone who has launched before, TORTUS creates a new user every time. Store the user_id you get back and resend it on every launch. See Persisting and resuming users.
string
Your own internal user ID, kept as a reference label on the TORTUS user. This is not a resume or lookup key: sending it does not match an existing user. Only userId resumes a user.
object
User information to associate with this session.

Response

If the user doesn’t already exist, TORTUS creates one and returns it in the response. A newly created user only becomes valid once the launch token has been exchanged.
string
The token to pass to the SDK. Valid for 5 minutes.
string
The TORTUS user ID for this session. Save it to resume the session later via userId.
number
Seconds until the token expires.

Persisting and resuming users

Each launch either resumes an existing TORTUS user or creates a new one. Which one you get depends entirely on whether you send userId. The rule is simple:
  1. First launch for a person: call the endpoint without userId (optionally with externalUserId and userPayload). Then use user_id from the response and save it against that person in your own system.
  2. Every later launch for the same person: send that saved value as userId to resume them.
Skip step 1’s save, or forget to send userId in step 2, and you create a duplicate user on every login. Here is the same loop in your launch route:

Wiring it into the SDK

Return the token from fetchClientSecrets. The SDK calls this whenever it needs fresh credentials.
Because tokens are short-lived, have your backend mint a fresh one on each call rather than caching it client-side.