Skip to main content
Mint a short-lived SDK token on your server and hand it to the Web SDK in the browser. Your API key never leaves the server. Stack: Go and the Gin framework.
1

Set your credentials

Put your keys in environment variables. Use https://dev.idto.ai (staging) while you build and https://prod.idto.ai (production) when you go live. Keep the client ID and API key on your server only. Never ship them to a browser or a mobile app.
.env
2

Install

3

Add the token endpoint

POST /api/idto/token calls POST /auth/sdk/token with your client ID and API key and returns only the token and its lifetime to the browser.
4

Open the verification flow

The page asks your server for a token and opens the flow. Use the workflow template ID from your dashboard, and drop env: "development" in production.
public/index.html
Serve public/index.html from the same origin as the API.
5

Run and check

200

Good to know

  • The SDK token lasts 900 seconds. Mint a new one for each verification instead of caching it.
  • Minting a token is not charged. Verifications that run inside the flow are charged as usual.
  • A 401 from /auth/sdk/token means the client ID or API key is wrong, or the client is inactive. Your endpoint returns 502 in that case so the browser never sees the upstream detail.
  • To confirm the result from your server after onWorkflowComplete, see Confirm a session result from your server.
Was this page helpful? Email us at tech@idto.ai with the page link.
Last modified on October 4, 2026