Chore: update edge function example (#32808)

Update auth.mdx
This commit is contained in:
Rodrigo Mansueli authored and GitHub committed 2025-01-15 15:20:43 -03:00
1 parent 592af2ffa2
commit 3e94bc483c
1 file changed
+6 -3
+6 -3
View File
@@ -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);
})
```