Skip to content

Commit 93d4ab8

Browse files
committed
idk
1 parent f0687fe commit 93d4ab8

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

supabase/functions/inituser/index.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,19 @@ Deno.serve(async (req) => {
1919
})
2020
}
2121

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+
2235
let uid: string | null = null;
2336

2437
try {

0 commit comments

Comments
 (0)