Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

fix: update to make explicit that there can be multiple secrets (#29553)

Joel Leef58afe2e76da
diff --git a/apps/docs/content/guides/auth/auth-hooks.mdx b/apps/docs/content/guides/auth/auth-hooks.mdx
index 5ca24eb75b9..cee056a29f6 100644
--- a/apps/docs/content/guides/auth/auth-hooks.mdx
+++ b/apps/docs/content/guides/auth/auth-hooks.mdx
@@ -105,9 +105,11 @@ When a HTTP hook is created, the secret generated should be of the following for
The secret is used to verify the payload received in your hook. Create an entry in your `.env.local` file to store the secret for each hook that you have. For example:
```bash
-HOOK_SECRET=<standard-base64-secret>
+HOOK_SECRETS=<standard-base64-secret>
```
+There field is expressed in plural rather than singular as there are plans to allow for asymmetric signing and multiple hook secrets for ease of secret rotation. For instance: `<standard-base-64-secret>|<another-standard-base-64-secret>`.
+
Use the secret in conjunction with the Standard Webhooks package to verify the payload before processing it:
```jsx
@@ -115,7 +117,7 @@ import { Webhook } from 'https://esm.sh/[email protected]'
Deno.serve(async (req) => {
const payload = await req.text()
- const hookSecret = Deno.env.get('HOOK_SECRET')
+ const hookSecret = Deno.env.get('HOOK_SECRETS')
// Extract headers and security specific fields
const headers = Object.fromEntries(req.headers)
const wh = new Webhook(hookSecret)
@@ -231,7 +233,7 @@ Modify the `auth.hook.<hook_name>` field and set `uri` to a valid HTTP URI. For
[auth.hook.send_sms]
enabled = true
uri = "http://host.docker.internal:54321/functions/v1/send_sms"
-secret = "env(SEND_SMS_HOOK_SECRET)"
+secrets = "env(SEND_SMS_HOOK_SECRET)"
```
`host.docker.internal` is a special DNS name used in Docker to allow a container to access the host machine's network. This allows the Auth container to reach the Functions container
@@ -239,7 +241,7 @@ secret = "env(SEND_SMS_HOOK_SECRET)"
Fill in the Hook Secret in `supabase/functions/.env`
```bash
-SEND_SMS_HOOK_SECRET='v1,whsec_<base64_standard_secret>'
+SEND_SMS_HOOK_SECRETS='v1,whsec_<base64_standard_secret>'
```
Start the function locally: