diff --git a/apps/docs/content/guides/self-hosting/docker.mdx b/apps/docs/content/guides/self-hosting/docker.mdx index ca849c63247ea..0573d84fed6dd 100644 --- a/apps/docs/content/guides/self-hosting/docker.mdx +++ b/apps/docs/content/guides/self-hosting/docker.mdx @@ -492,6 +492,24 @@ The script generates a new password, updates all database roles, and modifies yo sh run.sh recreate ``` +### Rotating API keys + +Unlike the managed platform, where you rotate keys from the Dashboard, self-hosted API keys live in your `.env` file. To rotate the publishable and secret keys (`SUPABASE_PUBLISHABLE_KEY` and `SUPABASE_SECRET_KEY`) without changing the asymmetric signing key pair, run: + +```sh +sh utils/rotate-new-api-keys.sh --update-env +``` + +Then restart the services and update your applications with the new keys: + +```sh +sh run.sh recreate +``` + +Use the publishable key in client apps and the secret key only in trusted server-side environments. Rotating these keys does not invalidate existing user session tokens. You can also set a custom value by editing `SUPABASE_PUBLISHABLE_KEY` or `SUPABASE_SECRET_KEY` in `.env` directly, then recreating the services. + +For rotating versus fully regenerating the asymmetric key pair (which does affect active sessions), see [New API Keys and Asymmetric Authentication](/docs/guides/self-hosting/self-hosted-auth-keys#regenerating-asymmetric-key-pair). + ### Configuring secrets The `generate-keys.sh` script sets the following secrets automatically. You can also configure them manually in the `.env` file if needed: diff --git a/apps/docs/content/guides/self-hosting/self-hosted-envoy.mdx b/apps/docs/content/guides/self-hosting/self-hosted-envoy.mdx index f4369c1fd3d47..627a95010d3b3 100644 --- a/apps/docs/content/guides/self-hosting/self-hosted-envoy.mdx +++ b/apps/docs/content/guides/self-hosting/self-hosted-envoy.mdx @@ -19,7 +19,7 @@ Envoy is registered as the `api-gw` service and also exposes `envoy` and `kong` Confirm the gateway is routing requests and enforcing API keys: ```sh -curl -i -H "apikey: your-service-role-key" http:///rest/v1/ +curl -i -H "apikey: your-supabase-secret-key" http:///rest/v1/ ``` A `200 OK` response from PostgREST confirms the gateway is up. A `401 Unauthorized` without the `apikey` header confirms enforcement is active. diff --git a/apps/docs/content/guides/self-hosting/self-hosted-oauth.mdx b/apps/docs/content/guides/self-hosting/self-hosted-oauth.mdx index 66e4872deb9c6..210e04635cf9e 100644 --- a/apps/docs/content/guides/self-hosting/self-hosted-oauth.mdx +++ b/apps/docs/content/guides/self-hosting/self-hosted-oauth.mdx @@ -99,7 +99,7 @@ sh run.sh recreate auth Check that the provider is enabled: ```sh -curl -H 'apikey: your-anon-key' https:///auth/v1/settings +curl -H 'apikey: your-supabase-publishable-key' https:///auth/v1/settings ``` The response should include your provider under `external`: @@ -350,9 +350,9 @@ You can test OAuth with the following minimal HTML page: