Closed emersonlaurentino closed 7 months ago
I'm using Hono and Deno, so I create a router /logout in order to sign out the logged user, but when I access the route, I receive a error from auth.admin.signOut with this message:
/logout
auth.admin.signOut
{ "name": "AuthApiError", "message": "This endpoint requires a Bearer token", "status": 401 }
This is the code that I'm using:
auth.get("/logout", async (c) => { const Authorization = c.req.header("Authorization")!; const supabaseClient = createClient(SUPABASE_URL ?? "", SUPABASE_KEY ?? "", { global: { headers: { Authorization } }, }); const { error } = await supabaseClient.auth.admin.signOut(Authorization); if (error) { c.status(error.status ?? 500); return c.json(error); } return c.json({ success: true }); });
I checked if the c.req.header("Authorization") returns the Bearer token, and yes, returns correctly.
c.req.header("Authorization")
Bug report
Describe the bug
I'm using Hono and Deno, so I create a router
/logout
in order to sign out the logged user, but when I access the route, I receive a error fromauth.admin.signOut
with this message:This is the code that I'm using:
I checked if the
c.req.header("Authorization")
returns the Bearer token, and yes, returns correctly.System information