Upcoming changes to Supabase API Keys #29260
Replies: 67 comments 125 replies
-
Is this live? |
Beta Was this translation helpful? Give feedback.
-
Dang. I was looking forward to an improved auth flow. |
Beta Was this translation helpful? Give feedback.
-
Would love to get an updated timeline for this, even if it's Q2/3/4 2025 |
Beta Was this translation helpful? Give feedback.
-
Will these custom api keys work for creating a rest api on an edge function and letting user authorize with an api key? |
Beta Was this translation helpful? Give feedback.
-
How can I manually generate the new API keys for an existing project? |
Beta Was this translation helpful? Give feedback.
-
Is there an updated timeline for the new keys, if not when can there be one? |
Beta Was this translation helpful? Give feedback.
-
Quick question: I have some migrations where I created a Do we just swap out the word Here is the sql: create table "public"."user" (
"id" uuid not null default gen_random_uuid(),
"created_at" timestamp with time zone not null default now(),
"email" text not null,
"first_name" text not null,
"last_name" text not null
);
alter table "public"."user" enable row level security;
CREATE UNIQUE INDEX user_pkey ON public."user" USING btree (id);
alter table "public"."user" add constraint "user_pkey" PRIMARY KEY using index "user_pkey";
grant delete on table "public"."user" to "anon";
grant insert on table "public"."user" to "anon";
grant references on table "public"."user" to "anon";
grant select on table "public"."user" to "anon";
grant trigger on table "public"."user" to "anon";
grant truncate on table "public"."user" to "anon";
grant update on table "public"."user" to "anon";
grant delete on table "public"."user" to "authenticated";
grant insert on table "public"."user" to "authenticated";
grant references on table "public"."user" to "authenticated";
grant select on table "public"."user" to "authenticated";
grant trigger on table "public"."user" to "authenticated";
grant truncate on table "public"."user" to "authenticated";
grant update on table "public"."user" to "authenticated";
grant delete on table "public"."user" to "service_role";
grant insert on table "public"."user" to "service_role";
grant references on table "public"."user" to "service_role";
grant select on table "public"."user" to "service_role";
grant trigger on table "public"."user" to "service_role";
grant truncate on table "public"."user" to "service_role";
grant update on table "public"."user" to "service_role"; |
Beta Was this translation helpful? Give feedback.
-
What's the plan for self-hosted via docker? Is it available there already? I did a quick scan but didn't see this in the docker files. |
Beta Was this translation helpful? Give feedback.
-
According to the FAQ:
I am using connection strings with Prisma. I just restored a project which was paused for inactivity and can no longer reach it from my application.
Also:
Has this policy changed? The connection instructions in the project show no change in the recommended setup for connecting with Prisma. |
Beta Was this translation helpful? Give feedback.
-
Updated timeline posted anywhere? |
Beta Was this translation helpful? Give feedback.
-
Has anything on this been actioned? |
Beta Was this translation helpful? Give feedback.
-
my current (old style) anon key has a start date of june 2025, can i migrate to new keys yet or how do i refresh the old one |
Beta Was this translation helpful? Give feedback.
-
Why must I pass both JWT token and anon API keys to access the PostgREST API? |
Beta Was this translation helpful? Give feedback.
-
@kangmingtay Will be be able to create multiple secret keys? It'll help with reducing downtime during key rotation. |
Beta Was this translation helpful? Give feedback.
This comment was marked as off-topic.
This comment was marked as off-topic.
-
How can we export the publishable secret key (for privileged, backend services) via the CLI or from the terraform resource? This is pretty much required for any IaC setup. |
Beta Was this translation helpful? Give feedback.
-
Reading https://supabase.com/docs/guides/functions/secrets, it looks like |
Beta Was this translation helpful? Give feedback.
This comment was marked as off-topic.
This comment was marked as off-topic.
-
Hello everyone, I love the API keys, but you need to make them available for local environment as well. We can't have differences between environments. Do you have in plan to release API keys for local env? Thanks |
Beta Was this translation helpful? Give feedback.
-
I migrated the from to use the new JWT a month ago, last night I updated the machine to latest postgres and now no one can login.... |
Beta Was this translation helpful? Give feedback.
-
After migrating and upgrading to PostgREST 13, I'm getting a "PGRST301 No suitable key or wrong key type" error when trying to create custom JWTs. I think the issue is related to this PostgREST/postgrest#4048. It seems like having kid mismatch between JWT and JWK is causing it, which would make sense. However, whenever I try to import a private key using |
Beta Was this translation helpful? Give feedback.
-
Hello, I have a frontend that uses Supabase auth, then I get that JWT and pass it to the Python server to make some complex calculations and use secrets. So on Python, I have an OAuth2PasswordBearer check for JWT and then create_client with it. I had this same setup for regular user endpoints and for some admin endpoints, just using a secret JWT. Now, with new api keys, I still can do the user endpoints with the Authorization header cause it is generated by the frontend, but what should I do with admin endpoints? This OAuth2PasswordBearer will not work for the secret api key. Maybe you can add some guides for cases like this? I think it will be the same logic for people who are using Supabase edge functions |
Beta Was this translation helpful? Give feedback.
-
Ok
…On Wed, 10 Sept 2025, 17:36 Martin DONADIEU, ***@***.***> wrote:
SU-242643 Issue is resolved for user, i had pg_temp in search path no idea
why and when that was added, i suspect it was when we checked why i had so
many pg_temp create without me doing so.
—
Reply to this email directly, view it on GitHub
<#29260 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BTBQAVECJEGXRWMQQ7SWXZL3SAZNPAVCNFSM6AAAAABODRV7OCVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTIMZWGM3TCMY>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
This comment was marked as spam.
This comment was marked as spam.
-
I have not imported any private keys to the platform and do not have any private keys as far as I am aware. What exactly do I need to do please?
Thanks
Steve
Steve Hawes
CIO
t: +44 (0)20 8158 5958
m: +44 (0)7831 338552
e: ***@***.***
w: www.elysiumwebservices.com
a:Connect 38, 1 Dover Place, Ashford, Kent, TN23 1FB
Elysium Web Services Limited is a company registered in England and Wales under number 14469124 with its registered office being at Connect 38 1 Dover Place, Ashford, United Kingdom, TN23 1FB.
This message contains confidential information and is intended only for the intended recipients. If you are not an intended recipient you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission. If verification is required please request a hard-copy version.
Elysium Web Services Limited may monitor email traffic data and also the content of emails for compliance purposes and to protect its business.
From: Han Qiao ***@***.***>
Date: Tuesday, 16 September 2025 at 17:07
To: supabase/supabase ***@***.***>
Cc: Steve Hawes ***@***.***>, Comment ***@***.***>
Subject: Re: [supabase/supabase] Upcoming changes to Supabase API Keys (Discussion #29260)
Hi there, this error was caused by kid mismatch between your local private key and the one imported to platform.
We have since released a fix for this but it would require you to import the same private key again.
Could you give that a try and let me know?
—
Reply to this email directly, view it on GitHub<#29260 (reply in thread)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AFSUXNZ6JBOWCTNIETVYYST3TAYVLAVCNFSM6AAAAABODRV7OCVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTINBRHAZTQOA>.
You are receiving this because you commented.
|
Beta Was this translation helpful? Give feedback.
-
Any update on the terraform provider? |
Beta Was this translation helpful? Give feedback.
-
It isn't entirely clear to me how or if the existing JWT secret's functionality is transferred over to the new API keys. Are we able to sign self-created JWTs using an API key, just like the existing JWT secret, and have that be respected in RLS? I have a trusted, secured endpoint that signs very limited keys for ephemeral headless resources, and I would really prefer those instances don't get full access to everything in the database, the blast radius of one of those machines being compromised is significantly higher if they get handed an API key than if they are just issued a JWT that has basically no permissions to modify anything but their own data. |
Beta Was this translation helpful? Give feedback.
-
Just sharing my feedback: IDK what happened guys, but our webhook that relied on legacy JWT just stopped working on Sep 17th, secrets were rotated to new keys and API that called function with legacy JWT stopped working. This had a major impact on the business, one of the critical services broke during merge-freeze. Quite frustrating experience with keys migration TBH... I'd appreciate an email or a banner somewhere before a breaking change. 😢 |
Beta Was this translation helpful? Give feedback.
-
Legacy JWT keys had a configurable "Access token expiry time". I don't see that field in "JWT Signing Keys"...trying to figure out how long signed in user's access token lasts before they need to use the refresh token. Did this change remove access tokens/refresh tokens, or is it now impossible to adjust the access token expiry time? |
Beta Was this translation helpful? Give feedback.
-
Use Deno.env.get("SUPABASE_SERVICE_ROLE_KEY") in Edge Functions to get the Secret key. After switching to the new api secret key, can no environment variable get the secret key? |
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.
-
We’re changing the way API keys work in Supabase to improve your project’s security and developer experience. Refer to the timetable below for key dates and info on actions you may need to take in the future.
This change starts out as early preview and is opt-in. No action necessary until at least 1st November 2025. We strongly encourage you to give the new API keys a try!
What's the change?
These are the planned changes for the API keys:
anon
andservice_role
keys remain available for use.sb_publishable_...
can be used to replace theanon
key.sb_secret_...
. You can also choose not to have a secret key if you don’t need one. Secret keys replace theservice_role
key.anon
andservice_role
keys, as needed during the migration period.Summarized, there are 4 types of API keys that can now be used with Supabase. This chart should illustrate it better:
sb_publishable_...
sb_secret_...
anon
service_role
Timetable
New projects will automatically generate both new API keys and legacy API keys to help ease the transition.
Existing projects can continue to use the legacy API keys and can opt in to use the new API keys by manually generating them.
Feedback and issues seen in the early preview period to be resolved.
Projects restored from 1st November 2025 will no longer be restored with the legacy API keys.
New projects no longer have
anon
andservice_role
available for use.Why are we doing this?
Since the start of Supabase, the JWT-based
anon
andservice_role
keys were the right trade-off between simplicity and relative security for your project. Unfortunately they pose some real challenges in live applications, especially around rotation and security best practices.The main reasons for making this change are:
anon
(low privilege),service_role
(high privilege), andauthenticated
(issued by Supabase Auth) Postgres roles.Start using the new API keys
It’s easy to start using the new API keys. You can opt in in the Supabase dashboard. This will create the default publishable key and a single secret API key.
For the most part, you can substitute the
sb_publishable_...
andsb_secret_...
values anywhere you used theanon
andservice_role
keys respectively. They work roughly the same in terms of permissions and data access.You can initialize any version of the Supabase Client libraries with the new values without any additional changes, and we don't expect any backward compatibility issues.
Key differences to be aware of
We've redesigned how the Supabase hosted platform deals with API keys with a few key goals:
To achieve these, the new API keys have some subtle differences from
anon
andpublishable
:--no-verify-jwt
which means they can be called without knowing any API key. You will need to apply this option to functions you are protecting without it.Authorization
header. It is no longer possible to use a publishable or secret key inside theAuthorization
header — because they are not a JWT. Instead pass in the user’s JWT, or leave the header empty. For backward compatibility, it is only allowed if the value in the header exactly matches the value in theapikey
header.We believe these limitations are minor and not likely to impact even a single-digit percentage of existing customers. Should you find any additional limitation do not hesitate to bring it up in this discussion or via Supabase Support.
Beta Was this translation helpful? Give feedback.
All reactions