Verifying tokens elsewhere
GET /api/auth/token (with a session cookie) returns a JWT signed with EdDSA (Ed25519). The
public keys are at /api/auth/jwks. That is the entire integration surface: no SDK, no shared secret,
no database access.
Claims
Section titled “Claims”| Claim | Meaning |
|---|---|
sub |
user id |
email, name, role, emailVerified |
snapshot at issue time |
iss, aud |
your ownauth BASE_URL — check both |
exp |
15 minutes after issue |
Because email and role are snapshots, a role change is not reflected in a token already issued.
Use short-lived tokens for authentication, and ask the API for authorization decisions.
import { createRemoteJWKSet, jwtVerify } from "jose";
const jwks = createRemoteJWKSet(new URL(`${OWNAUTH_URL}/api/auth/jwks`));const { payload } = await jwtVerify(token, jwks, { issuer: OWNAUTH_URL, audience: OWNAUTH_URL });Python
Section titled “Python”import jwtfrom jwt import PyJWKClient
key = PyJWKClient(f"{AUTH_URL}/api/auth/jwks").get_signing_key_from_jwt(token)claims = jwt.decode(token, key.key, algorithms=["EdDSA"], issuer=AUTH_URL, audience=AUTH_URL)Runnable versions of this, plus Go and Ruby references, are in examples/jwks/ in the repository.
The Python one is executed against a live instance; the Go and Ruby files are marked as references
because their toolchains are not present on the build host, and calling unrun code verified is how
integrations break quietly.
What each check prevents
Section titled “What each check prevents”| Check | Failure it prevents |
|---|---|
| signature against JWKS | forged tokens |
iss equals your instance |
a token minted by a different ownauth |
aud equals your instance |
replay against another audience |
exp |
a token that should have stopped working |
A token signed by a different instance fails with a key id that is not in your key set — which is the behaviour you want, and a good test that your issuer check is real.