API reference

Token validation

Read the scute_token from the redirect after a hosted verification and verify it with the JWKS.

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 #).

ModeURL
Query string (default)https://your-app.com/verified?ticket=1139&scute_token=eyJhbGc...
Fragmenthttps://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.

app/verified/page.tsxts
"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#

GET/v1/auth/:app_id/.well-known/jwks.jsonNone
app_idstringrequired
Path. The app's app_... ID or UUID. GET /v1/auth/:app_id/jwks returns the same document.
Requestbash
curl https://api.scute.io/v1/auth/$SCUTE_APP_ID/.well-known/jwks.json

The 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.

Statuserror_codeWhen
404app_not_foundNo app with that ID.
503keys_not_availableThe 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.

lib/verify-scute-token.tsts
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#

ClaimTypeDescription
substringEmail of the verified user, from the user's Scute record. null when the user has no email.
emailstringSame as sub. Present only when the user has an email.
verification_idstringThe challenge id.
intentstringThe intent sent when the challenge was created.
verified_atnumberUnix time the challenge was completed.
issstringAlways scute.
audstringUUID of the app that issued the token.
iatnumberIssued at, Unix time.
expnumberExpiry, 60 seconds after iat.
msp_idstringThe MSP's msp_... ID. Only on workspace challenges.
msp_app_idstringThe client app's app_... ID. Only on workspace challenges.
contact_emailstringFrom metadata.contact_email, when set.
ticket_idstringFrom metadata.ticket_id, when set.
contact_idstringFrom metadata.contact_id, when set.
contact_namestringFrom metadata.contact_name, when set.
company_idstringFrom metadata.company_id, when set.
consentstringapproved, 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.