When a person completes a verification on Scute's hosted verify page, Scute redirects them to your redirect URL and appends a scute_token. The token is a JWT signed with RS256 by your workspace's RSA key. It expires 60 seconds after it is issued: verify it as soon as it arrives and exchange it for your own session.
Redirect URL#
Scute uses metadata.redirect_url of the challenge, or else the app's verification redirect URL template. Values from the challenge metadata are filled into the URL (for example {ticket_id}).
The host of the resolved URL must be the app's origin, one of its additional origins, or the host of the app's redirect URL template. Otherwise Scute drops the redirect, so the person is not sent to that host with a token.
Where the token goes#
Each app delivers the token in one place, set by verification_token_in_fragment on the app (dashboard: the app's Verification page, Token after the #).
| Mode | URL |
|---|---|
| Query string (default) | https://your-app.com/verified?ticket=1139&scute_token=eyJhbGc... |
| Fragment | https://your-app.com/verified?ticket=1139#scute_token=eyJhbGc... |
The token is the same in both modes. Browsers do not send the fragment to servers, so in fragment mode the token stays out of access logs, Referer headers and most analytics. The token carries personal data (the user's email and values from your metadata), so use fragment mode in production.
Scute reads the setting when it builds the redirect. Every redirect after a change uses the new mode, including challenges created before it.
"use client";import { useEffect } from "react";export default function Verified() { useEffect(() => { const params = new URLSearchParams(window.location.hash.replace(/^#/, "")); const token = params.get("scute_token"); if (token) { history.replaceState(null, "", window.location.pathname + window.location.search); fetch("/api/verified", { method: "POST", body: JSON.stringify({ token }) }); } }, []); return <p>Verifying...</p>;}A server-rendered landing page cannot read the fragment. Render a small page that reads location.hash and posts the token to your server, or stay on query string mode and keep scute_token out of your logs.
JWKS#
/v1/auth/:app_id/.well-known/jwks.jsonNonecurl https://api.scute.io/v1/auth/$SCUTE_APP_ID/.well-known/jwks.jsonThe document holds the workspace's current signing key and, after a key rotation, earlier keys that can still verify tokens. The token header names the key in kid.
| Status | error_code | When |
|---|---|---|
| 404 | app_not_found | No app with that ID. |
| 503 | keys_not_available | The workspace has no RSA keys yet. |
Verify the token#
Check the signature, iss and aud. aud is the UUID of the app that issued the token, not its app_... ID. For a workspace challenge the issuing app is the workspace's verification app.
import { createRemoteJWKSet, jwtVerify } from "jose";const APP_UUID = process.env.SCUTE_APP_UUID!;const JWKS = createRemoteJWKSet( new URL(`https://api.scute.io/v1/auth/${APP_UUID}/.well-known/jwks.json`));export async function verifyScuteToken(token: string) { const { payload } = await jwtVerify(token, JWKS, { algorithms: ["RS256"], issuer: "scute", audience: APP_UUID, }); return payload;}Claims#
| Claim | Type | Description |
|---|---|---|
| sub | string | Email of the verified user, from the user's Scute record. null when the user has no email. |
| string | Same as sub. Present only when the user has an email. | |
| verification_id | string | The challenge id. |
| intent | string | The intent sent when the challenge was created. |
| verified_at | number | Unix time the challenge was completed. |
| iss | string | Always scute. |
| aud | string | UUID of the app that issued the token. |
| iat | number | Issued at, Unix time. |
| exp | number | Expiry, 60 seconds after iat. |
| msp_id | string | The MSP's msp_... ID. Only on workspace challenges. |
| msp_app_id | string | The client app's app_... ID. Only on workspace challenges. |
| contact_email | string | From metadata.contact_email, when set. |
| ticket_id | string | From metadata.ticket_id, when set. |
| contact_id | string | From metadata.contact_id, when set. |
| contact_name | string | From metadata.contact_name, when set. |
| company_id | string | From metadata.company_id, when set. |
| consent | string | approved, in consent flows only. A denied consent issues no token. |
sub never comes from metadata.contact_email. Use msp_app_id to route a workspace challenge's result to the right client.