JavaScript: Get user claims from verified JWT (original) (raw)

Extracts the JWT claims present in the access token by first verifying the JWT against the server's JSON Web Key Set endpoint /.well-known/jwks.json which is often cached, resulting in significantly faster responses. Prefer this method over #getUser which always sends a request to the Auth server for each JWT.

If the project is not using an asymmetric JWT signing key (like ECC or RSA) it always sends a request to the Auth server (similar to #getUser) to verify the JWT.

Parameters

(Optional)
An optional specific JWT you wish to verify, not the one you can obtain from #getSession.

(Required)
Various additional options that allow you to customize the behavior of this method.

Examples

Get JWT claims, header and signature

const { data, error } = await supabase.auth.getClaims()