Access tokens are JWTs signed with the workspace's RSA key (RS256). Every app in a workspace shares the workspace's keys. The token header names the key in kid.
Get the JWKS#
/v1/auth/:app_id/.well-known/jwks.jsonNoneGET /v1/auth/:app_id/jwks returns the same document. :app_id is the app's UUID or app_xxx public ID.
curl https://api.scute.io/v1/auth/$SCUTE_APP_ID/.well-known/jwks.json{ "keys": [ { "kty": "RSA", "kid": "f3b1c2d4e5", "use": "sig", "alg": "RS256", "n": "0vx7agoebGcQSuuPiLJXZptN9nndrQmbXEps2aiAFbWhM78LhWx4cbbfAAtVT86zwu1RK7aPFFxuhDR1L6tSoc_BJECPebWKRXjBZCiFV4n3oknjhMstn64tZ_2W-5JsGY4Hc5n9yBXArwl93lqt7_RN5w6Cf0h4QyQ5v-65YGjQR0_FDW2QvzqY368QQMicAtaSqzs8KJZgnYb9c7d0zgdAZHzu6qMQvRL5hajrn1n91CbOpbISD08qNLyrdkt-bFTWhAI4vMQFh6WeZu0fM4lFd2NcRwr3XPksINHaQ-G_xBniIqbw0Ls1jF44-csFCur-kEgU8awapJzKnqDKgw", "e": "AQAB" } ]}The first key is the one that signs now. After a signing key rotation, earlier keys stay in the list until no token they signed can still be valid, so sessions do not end at a rotation. Match the token's kid to a key.
| Status | error_code | When |
|---|---|---|
| 404 | app_not_found | No app with that ID. |
| 503 | keys_not_available | The workspace has no RSA keys yet. |
Get the public key as PEM#
/v1/auth/:app_id/public_keyNoneReturns the current signing key only.
{ "public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA...\n-----END PUBLIC KEY-----\n", "algorithm": "RS256", "key_id": "f3b1c2d4e5"}Prefer the JWKS: it also carries the earlier keys that still verify.
Access token claims#
| Claim | Description |
|---|---|
| uuid | The app user's ID. |
| aid | The app's public ID (app_xxx). |
| wid | The workspace's ID. |
| msp_id | Public ID (msp_xxx) of the MSP the app's workspace belongs to. Only under an MSP. |
| crid | ID of the passkey used, on sessions started with a passkey. |
| uid | ID of this access token. Changes on every refresh. |
| ruid | ID of the session's refresh token. |
| exp | Expiry, as a Unix timestamp. |
Access tokens carry no iss or aud claim. Check aid against your app's public ID instead.
Verify a token offline#
import { createRemoteJWKSet, jwtVerify } from "jose";const APP_ID = process.env.SCUTE_APP_ID!; // app_xxxconst JWKS = createRemoteJWKSet( new URL(`https://api.scute.io/v1/auth/${APP_ID}/.well-known/jwks.json`));export async function verifyScuteToken(token: string) { const { payload } = await jwtVerify(token, JWKS, { algorithms: ["RS256"] }); if (payload.aid !== APP_ID) throw new Error("Token is for another app"); return { userId: payload.uuid as string, workspaceId: payload.wid as string };}An offline check confirms the signature and expiry. It does not see a session that was revoked or signed out before the token expired. When you need that, call Check an access token, or keep access token lifetimes short.