Supabase Auth: Asymmetric Keys support in 2025 #29289
Replies: 24 comments 66 replies
-
|
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.
-
|
Any updates on this? |
Beta Was this translation helpful? Give feedback.
-
|
Hello, is there any update on this? getUser performance lag affects us a lot. |
Beta Was this translation helpful? Give feedback.
-
|
Glad to see this coming along. I wanted to integrate Privy.io and asked them about how to do it. They sent me here: |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
Hey! Any idea when asymmetric keys will be available? Is there an updated timeline? |
Beta Was this translation helpful? Give feedback.
-
|
Any update on the timeline for this? We are trying to decide how to proceed with verifying JWTs for some of our API-to-API requests. |
Beta Was this translation helpful? Give feedback.
-
@kangmingtay there's only about a week left to make a Q1 2025 finalized timeline announcement |
Beta Was this translation helpful? Give feedback.
-
|
Are there any updates on the updated timeline? It's already Q2 2025 |
Beta Was this translation helpful? Give feedback.
-
|
@kangmingtay Hey Kang, we need to make a decision if to use Supabase or another PaaS - there is no way to use GCP Workload Identify Federation [1] with Supabse without Supabase providing a public JWKS endpoint, afaik. As you see here the community needs an update on the timeline as well. Please provide here, or escalate to your manager :-) Cheers from Berlin [1] https://medium.com/google-cloud/gcp-workload-identity-federation-with-federated-tokens-d03b8bad0228 |
Beta Was this translation helpful? Give feedback.
-
|
yo. we need this.... |
Beta Was this translation helpful? Give feedback.
-
|
Hey folks, we're soon (days) going to update this announcement. I know all of you have been waiting for this! |
Beta Was this translation helpful? Give feedback.
-
|
Hey everyone. Sorry to keep y'all waiting. We're announcing this in about 24 hours. 🤞 supabase.com/launch-week |
Beta Was this translation helpful? Give feedback.
-
|
It's now been launched! https://supabase.com/blog/jwt-signing-keys |
Beta Was this translation helpful? Give feedback.
-
|
I tried to port my edge functions to asymmetric JWT keys and here are some things that I got stuck with:
Current Return Values of
|
Beta Was this translation helpful? Give feedback.
-
|
@hf This is an exciting upgrade to Supabase Auth! Is there an equivalent of the previously available === Edit: There is no equivalent claim available in the JWT payload by default. I figured I could use the custom access token hook and then expose it myself by doing a lookup against the |
Beta Was this translation helpful? Give feedback.
-
|
Anyone took a try to update their nextjs/ssr implementation with the new method? Would love some pointers to update this.
|
Beta Was this translation helpful? Give feedback.
-
|
Update: resolved I tried to opt-in today, but get the following message:
When will this be generally available? |
Beta Was this translation helpful? Give feedback.
-
|
Hello everyone, I'm currently integrating Supabase Auth into my application. Specifically, I'm trying to use Is it considered best practice to first validate the JWT using I've gone through the public resources, but I'm still having trouble understanding how to properly implement the |
Beta Was this translation helpful? Give feedback.
-
|
Hi, is there a way to revert back to the legacy JWT secret? I need to create a new custom JWT secret provided by an external auth provider. I've migrated a project to the new JWT signing keys, but since I am using Kinde for auth, which is not a supported third party auth provider, I am unable to authenticate requests without doing an unideal key exchange. |
Beta Was this translation helpful? Give feedback.
-
|
I've moved over to getClaims on my React Router 7 / Remix application. If anything, I am seeing a performance deterioration compared to the way I was doing things previously - let me explain: Prior to getClaims, I did things on my own environment without hitting the Auth server as follows: This meant that at the server level, we just used the cookie on the request, got the JWT, and verified it using the legacy JWT secret that we stored in env. Of course, the legacy JWT secret has a nonzero chance to leak, so I understand the security implications of this approach. For this reason, I decided to move over to the new asymmetric keys, as not only it would make the code easier to maintain, it would also come with the security benefit. However - in my case getClaims keeps hitting the server for the key with every invocation. I can't get my supabase client to cache the key. I am using the SSR client, and therefore creating a new server client for each invocation (as recommended by the docs if I remember correctly). Maybe this is why the key is not being cached. To clarify my question - Does getClaims, when used with the SSR client, give you the performance benefit of not having to hit the Auth servers due to caching of some sort? If so, how does this caching work? - I guess an option might be to cache the key ourselves, but this should be stated and documented. |
Beta Was this translation helpful? Give feedback.
-
|
Hey there! I am testing this getClaims() thing. It took me a while to understand that the session is till needed but anyways I just wanted to share my new approach because it took me a few hours to understand the following:
Am I wrong? NOTE: There is a report that with this migration to the JWT keys, we can't generate types anymore but there is an opened post for issues anyways. "failed to retrieve generated types......" Thank you team for improving Supabase on a daily basis. (I hope it stays affordable) |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
The getClaims method doesn’t support refreshing data when a |
Beta Was this translation helpful? Give feedback.






Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
This is now live! Read the blog post.
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.jsonendpoint. 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
getClaimswhich handles verifying both symmetric and asymmetric JWTs:Example successful response payload for
getClaims(){ "data": { "iss": "https://projectref.supabase.co", "sub": "565dafb5-fd66-4274-9c37-f0ff720f5637", "aud": "authenticated", "exp": 1824717902, "iat": 1724717902, "email": "[email protected]", "phone": "", "app_metadata": { "provider": "email", "providers": ["email"] }, "user_metadata": { ... }, "role": "authenticated", "aal": "aal1", "amr": [ { "method": "oauth", "timestamp": 1724717902 } ], "session_id": "479c1cbf-bd52-42d4-894f-1519f39b3241", "is_anonymous": false }, "error": null }Using
getClaims()to verify the JWTCreate an asymmetric key through the dashboard. At this point the symmetric JWT moves to a
Previously Usedstate. 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