Skip to content

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

feat: update hook docs with information on permissions and a typecast (#20793)

Joel Lee0c81cc9910ec
diff --git a/apps/docs/pages/guides/auth/auth-hooks.mdx b/apps/docs/pages/guides/auth/auth-hooks.mdx
index 2dea224ee4d..8fd85c7ed39 100644
--- a/apps/docs/pages/guides/auth/auth-hooks.mdx
+++ b/apps/docs/pages/guides/auth/auth-hooks.mdx
@@ -73,6 +73,13 @@ grant execute
to supabase_auth_admin;
```
+You also need to grant usage to `supabase_auth_admin`:
+
+```sql
+grant usage on schema public to supabase_auth_admin;
+```
+
+
Also revoke permissions from the `authenticated` and `anon` roles to ensure the function is not accessible by Supabase Serverless APIs.
```sql
@@ -567,7 +574,7 @@ as $$
is_admin boolean;
begin
-- Check if the user is marked as admin in the profiles table
- select is_admin into is_admin from profiles where user_id = event->>'user_id';
+ select is_admin into is_admin from profiles where user_id = event->>'user_id'::uuid;
-- Proceed only if the user is an admin
if is_admin then