Skip to content

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

Chore: update also last example on the page (#32809)

Rodrigo Mansuelif233c787941a
diff --git a/apps/docs/content/guides/functions/auth.mdx b/apps/docs/content/guides/functions/auth.mdx
index d940cf65a02..7b97b497278 100644
--- a/apps/docs/content/guides/functions/auth.mdx
+++ b/apps/docs/content/guides/functions/auth.mdx
@@ -71,11 +71,13 @@ Deno.serve(async (req: Request) => {
const supabaseClient = createClient(
Deno.env.get('SUPABASE_URL') ?? '',
Deno.env.get('SUPABASE_ANON_KEY') ?? '',
- { global: { headers: { Authorization: req.headers.get('Authorization')! } } }
- )
+ );
- // Database queries will have RLS policies enforced
- const { data, error } = await supabaseClient.from('profiles').select('*')
+ // Get the session or user object
+ const authHeader = req.headers.get('Authorization')!;
+ const token = authHeader.replace('Bearer ', '');
+ const { data: userData } = await supabaseClient.auth.getUser(token);
+ const { data, error } = await supabaseClient.from('profiles').select('*');
return new Response(JSON.stringify({ data }), {
headers: { 'Content-Type': 'application/json' },