Supabase Auth: Asymmetric Keys support in Q4 2024 #29289
Pinned
kangmingtay
announced in
Changelog
Replies: 2 comments 1 reply
-
This is 🔥 A question though: Given the below, // getClaims() will always return the JWT payload if the JWT is verified
// If it's an asymmetric JWT, getClaims() will verify using the JWKs endpoint.
// If it's a symmetric JWT, getClaims() calls getUser() to verify the JWT.
const { data, error } = await supabase.auth.getClaims(jwks) Is this saying that a naked import { createClient } from 'supabase/supabase-js'
import { JWKS, SUPABASE_URL, SUPABASE_PUBLISHABLE_KEY } from 'your-environment'
const supabase = createClient(SUPABASE_URL, SUPABASE_PUBLISHABLE_KEY)
const { data, error } = await supabase.auth.getClaims(JWKS) |
Beta Was this translation helpful? Give feedback.
1 reply
-
Any updates on this? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Asymmetric key changelog
Introduction
We are introducing asymmetric key cryptography to Supabase Auth in Q4 2024
on 7th October 2024. This will be provided as an additional option to the JWT secret currently shown in the JWT settings page.Why are we doing this?
Supabase Auth has always been using a symmetric secret (known as the JWT secret) for signing and verifying JWTs. While this is simple and convenient (since the same secret is used for both signing and verifying), it presents the following problems:
Benefits of using asymmetric keys
Asymmetric keys rely on public / private key cryptography, which means that the private key is only used for signing, while the public key is only used for verifying. This solves the above problems in the following way:
getUser()
. The public key can be used for verifying the JWT. Note that adding the symmetric secret to your server-side environment to verify the JWT also has the same effect but is potentially less secure since there is an increased risk of the secret being leaked if it is used in multiple applications.These will include the following changes:
https://<project_ref>.supabase.co/auth/v1/.well-known/jwks.json
endpoint. The symmetric secret will not be exposed through this endpoint for security reasons.getClaims()
, which handles verifying the JWT and returning the claims in it.Migration to Asymmetric JWTs
New projects that are created after 1st May 2025 will be created with an RSA asymmetric key by default. Existing projects can choose to start using asymmetric keys by doing the following:
Ensure that you are using the new API keys.
Update all your clients to use at least supabase-js version x.x.x (the version number will be updated closer to the release date). In this version, we are introducing a new method called
getClaims
which handles verifying both symmetric and asymmetric JWTs:Example successful response payload for
getClaims()
Using
getClaims()
to verify the JWTCreate an asymmetric key through the dashboard. At this point the symmetric JWT moves to a
Previously Used
state. Existing JWTs signed with the symmetric JWT continue to be valid, but new JWTs are signed via the asymmetric JWT. Note: The UI mockup below is subjected to change and is just meant to illustrate the different possible states of a signing key.Frequently Asked Questions
Beta Was this translation helpful? Give feedback.
All reactions