Embedded iframe SSO

Mint a short-lived user refresh token with your API key, then log that user into an embedded Tarot iframe.

How it works

Use this when your product embeds Tarot Routing in an iframe and you want the user already logged in, without showing a Tarot login form.

The flow is:

  1. Create an API key whose role includes the delegated_login access level.
  2. From your server, mint a short-lived (60s) user refresh token for that user’s email.
  3. Immediately load the iframe with that token in the authtoken query parameter.

Tarot logs the user in inside the iframe. The sections below cover each step in detail.

Enablement

  1. Get an API key in Tarot Routing. Generate keys at route.optimiser.app or via Admin Panel → User Management → API Keys. See Getting an API key.
  2. Ensure the API-key identity’s role includes the delegated_login access level.

Mint a user refresh token

From your server, call:

POST /v3/core/auth/delegated_token

Body:

{ "email": "planner@example.com" }

Send the API key in the request header:

HTTP Request Header
X-Tarot-API-Key: trout_k7p2m9x4q8va_xxxxxxxxxxxxxxxxxxxxxxxxx
curl -X POST "https://api.optimiser.app/v3/core/auth/delegated_token" \
  -H "X-Tarot-API-Key: $TAROT_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{"email": "planner@example.com"}'

Response:

{
  "access_token": "<user v2 JWT, sub=user:{id}, ~15m>",
  "refresh_token": "<user refresh JWT, ~60s>",
  "refresh_token_expiry": "…"
}

refresh_token is a short-lived (60s) user refresh JWT. Use that value. Ignore access_token and refresh_token_expiry.

Iframe handoff

Put the minted refresh JWT in the iframe URL immediately after minting:

https://route.optimiser.app/?authtoken=<refresh_token>

The user will be logged in in the iframe.