The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Docs/update troubleshooting guide rotate jwt (#41689)
Supun Sudaraka2df9d1ebcab6
diff --git a/apps/docs/content/troubleshooting/rotating-anon-service-and-jwt-secrets-1Jq6yd.mdx b/apps/docs/content/troubleshooting/rotating-anon-service-and-jwt-secrets-1Jq6yd.mdxindex 437ba106cfc..f8eda9f9c2a 100644--- a/apps/docs/content/troubleshooting/rotating-anon-service-and-jwt-secrets-1Jq6yd.mdx+++ b/apps/docs/content/troubleshooting/rotating-anon-service-and-jwt-secrets-1Jq6yd.mdx@@ -7,26 +7,45 @@ keywords = [ "jwt", "secrets", "key", "security" ]database_id = "caa72a34-696c-47c6-8976-e50cf7fb396e"---+<Admonition type="deprecation">++This troubleshooting guide is about rotating **Legacy anon, service_role API keys**. We are deprecating Legacy+, and recommend migrating to New API keys. To learn more about API+keys, refer to [the API documentation](/docs/guides/api/api-keys).++</Admonition>++<Admonition type="tip">++Once the JWT secret is regenerated, all current API secrets will be immediately invalidated, and+all connections using them will be severed. You will need to deploy the new secrets for+connections to begin working again. You can avoid downtime by migrating to new API Keys.++</Admonition>+Have you ever accidentally committed a service key to a public repo? Or maybe rotating keys is just something you regularly do for security compliance.Whatever the reason, here's how to rotate the keys for your Supabase project.-1. Go to the [API Settings page](/dashboard/project/_/settings/api-keys/new) in the Supabase Dashboard-2. Find the JWT Secrets section+If you haven’t migrated to asymmetric JWT signing keys:++{/* supa-mdx-lint-disable Rule004ExcludeWords */}++1. Go to [**Project Settings** → **JWT Keys**](/dashboard/project/_/settings/jwt) in the Supabase Dashboard+2. Navigate to the **Legacy JWT Secret** tab+3. Click on **Change Legacy Secret**+ - Click on **Generate a random secret** to let Supabase decide the JWT secret.+ - Click on **Create my own secret** to enter a custom JWT secret+4. You will see a Confirmation dialog. Read it through and confirm to proceed.-<img- width="1072"- alt="Screenshot 2023-12-27 at 08 39 41"- src="https://github.com/supabase/supabase/assets/1923424/bdcab8a2-7007-496c-a845-d331ee883a0a"-/>+If you have migrated to new symmetric JWT signing keys:-3. Click the `Generate new secret` button and choose either a random secret, or custom if you'd like to supply one of your own.-4. NOTE: Once regenerated, all current API secrets will be immediately invalidated, and all connections using them will be severed. You will need to deploy the new secrets for connections to begin working again.-5. Confirm the changes in the warning that pops up by clicking `Generate New Secret` again.+1. Go to [**Project Settings** → **JWT Keys**](/dashboard/project/_/settings/jwt)s in the Supabase Dashboard+2. Navigate to the **JWT Signing Keys** tab.+3. Click on Rotate Keys. This will move the current key to “Previously used keys”+4. Select the three-dot icon (action icon) of your previously used key and click “Revoke”. If you do not “Revoke” the key, older keys will still be valid.-<img- width="517"- alt="Screenshot 2023-12-27 at 08 39 59"- src="https://github.com/supabase/supabase/assets/1923424/1f5cf876-ff65-41f0-b92e-37826773041c"-/>+## Further readings-6. After confirming, the secret will be generated, and Supabase will start rolling that out across our services. Postgres will restart, the API gateways will be updated, etc. Once the process is complete, you will be able to see your new JWT secret as well as the new anon and service keys.+- [How to rotate the service role key](/docs/guides/api/api-keys#i-am-using-jwt-based-anon-key-in-a-mobile-desktop-or-cli-application-and-need-to-rotate-my-servicerole-jwt-secret)+- [What to do if a secret key or service_role has been leaked or compromised?](/docs/guides/api/api-keys#what-to-do-if-a-secret-key-or-servicerole-has-been-leaked-or-compromised)+- [JWT Signing Keys](/docs/guides/auth/signing-keys)