Skip to content

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

Chore: update edge function example (#32808)

Rodrigo Mansueli3e94bc483c92
diff --git a/apps/docs/content/guides/functions/auth.mdx b/apps/docs/content/guides/functions/auth.mdx
index 639e667ff34..d940cf65a02 100644
--- a/apps/docs/content/guides/functions/auth.mdx
+++ b/apps/docs/content/guides/functions/auth.mdx
@@ -16,12 +16,15 @@ import { createClient } from 'jsr:@supabase/supabase-js@2'
Deno.serve(async (req: Request) => {
- const authHeader = req.headers.get('Authorization')!
const supabaseClient = createClient(
Deno.env.get('SUPABASE_URL') ?? '',
Deno.env.get('SUPABASE_ANON_KEY') ?? '',
- { global: { headers: { Authorization: authHeader } } }
- )
+ );
+
+ // Get the session or user object
+ const authHeader = req.headers.get('Authorization')!;
+ const token = authHeader.replace('Bearer ', '');
+ const { data } = await supabaseClient.auth.getUser(token);
})
```