Rotating Anon, Service, and JWT Secrets
Last edited: 2/21/2025
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.
- Go to the API Settings page in the Supabase Dashboard
- Find the JWT Secrets section
- Click the
Generate new secret
button and choose either a random secret, or custom if you'd like to supply one of your own. - 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.
- Confirm the changes in the warning that pops up by clicking
Generate New Secret
again.
- 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.