Verify tokens
Validate the access token in your API without calling Amped.Bio on every request.
Access tokens are RS256 signed JWTs. Verify them locally against our JWKS:
TS
import { createRemoteJWKSet, jwtVerify } from "jose";
const jwks = createRemoteJWKSet(new URL("https://auth.amped.bio/.well-known/jwks.json"));
const { payload } = await jwtVerify(accessToken, jwks, {
issuer: "https://auth.amped.bio",
audience: "https://your-api.example.com", // the resource you registered
});
const userId = payload.sub as string;
const scopes = String(payload.scope ?? "")
.split(" ")
.filter(Boolean);Checklist:
- Signature: verified with the JWKS above. Key ids (
kid) are rotated by adding keys, never by replacing them. - Issuer: must be
https://auth.amped.bio. - Audience: the
resourcethe client requested. Reject tokens minted for another resource. - Expiry:
expis 15 minutes from issuance by default. - Scopes: require the scopes your endpoint needs.
Using the Better Auth resource server helper
If your API already depends on Better Auth, verifyAccessTokenRequest performs the same checks, including
DPoP proofs and replay protection when present:
TS
import { requestToResourceInput, verifyAccessTokenRequest } from "better-auth/oauth2";
const payload = await verifyAccessTokenRequest(requestToResourceInput(request), {
verifyOptions: {
issuer: "https://auth.amped.bio",
audience: "https://your-api.example.com",
},
requiredScopes: ["mcp:read"],
});Opaque tokens
If your client cannot accept JWTs, send the token to the introspection endpoint instead. Introspection
requires client authentication and returns the same claims plus active.
Bash
curl -sS https://auth.amped.bio/oauth2/introspect \
-u "YOUR_CLIENT_ID:YOUR_CLIENT_SECRET" \
-d token=ACCESS_TOKENEnding access
POST /oauth2/revokewithtoken_type_hint=refresh_tokencuts off refresh, and every access token that carries the same session id stops verifying immediately.- Users can revoke your application from Account settings, Developers tab, Authorized applications.