We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f0687fe commit 93d4ab8Copy full SHA for 93d4ab8
supabase/functions/inituser/index.ts
@@ -19,6 +19,19 @@ Deno.serve(async (req) => {
19
})
20
}
21
22
+ const authHeader = req.headers.get('Authorization')
23
+ if (!authHeader) {
24
+ return new Response('Authorization header missing', { status: 401 })
25
+ }
26
+
27
+ const token = authHeader.split(' ')[1] // Bearer token
28
29
+ // Verify the token using Supabase client SDK (make sure supabase client is initialized)
30
+ const { data: user, error } = await supabase.auth.api.getUser(token)
31
+ if (error || !user) {
32
+ return new Response('Invalid JWT', { status: 401 })
33
34
35
let uid: string | null = null;
36
37
try {
0 commit comments