Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

docs(python): add get_claims method (#37549)

Andrew Smith61237605c1a2
diff --git a/apps/docs/spec/supabase_py_v2.yml b/apps/docs/spec/supabase_py_v2.yml
index a19afdbd019..661cf1e884e 100644
--- a/apps/docs/spec/supabase_py_v2.yml
+++ b/apps/docs/spec/supabase_py_v2.yml
@@ -925,6 +925,74 @@ functions:
{"provider_id": "21648a9d-8d5a-4555-a9d1-d6375dc14e92"}
)
```
+ - id: get-claims
+ title: 'get_claims'
+ params:
+ - name: jwt
+ isOptional: true
+ type: string
+ description: An optional specific JWT you wish to verify, not the one you can obtain from [`get_session`](/docs/reference/python/auth-getsession).
+ - name: jwks
+ isOptional: true
+ type: JWKSet
+ description: If set, this JSON Web Key Set is going to have precedence over the cached value available on the server.
+ subContent:
+ - name: keys
+ isOptional: false
+ type: list<JWK>
+ subContent:
+ - name: key_opt
+ isOptional: false
+ type: list[string]
+ - name: kty
+ isOptional: false
+ type: RSA | EC | oct
+ - name: alg
+ isOptional: false
+ type: string
+ - name: kid
+ isOptional: false
+ type: string
+ notes: |
+ 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 [`get_user`](/docs/reference/python/auth-getuser) which always sends a request to the Auth server for each JWT.
+ examples:
+ - id: get-user-object
+ name: Get user object
+ isSpotlight: true
+ code: |
+ ```
+ response = supabase.auth.get_claims()
+ ```
+ response: |
+ ```json
+ {
+ "claims": {
+ "aal": "aal1",
+ "amr": [{
+ "method": "email",
+ "timestamp": 1715766000
+ }],
+ "app_metadata": {},
+ "aud": "authenticated",
+ "email": "[email protected]",
+ "exp": 1715769600,
+ "iat": 1715766000,
+ "is_anonymous": false,
+ "iss": "https://api.supabase.com/auth/v1",
+ "phone": "+13334445555",
+ "role": "authenticated",
+ "session_id": "11111111-1111-1111-1111-111111111111",
+ "sub": "11111111-1111-1111-1111-111111111111",
+ "user_metadata": {}
+ },
+ "header": {
+ "alg": "RS256",
+ "typ": "JWT",
+ "kid": "abcdefgh"
+ },
+ "signature": [/** Uint8Array */],
+ }
+ ```
- id: sign-out
title: 'sign_out()'
params: