From a8cf33aed76ade67f956e6b2b06da96dde7bfb0a Mon Sep 17 00:00:00 2001 From: mahaprasad nanda Date: Fri, 19 Jun 2026 22:17:01 +0530 Subject: [PATCH] Remove unused Supabase request auth helper --- backend/src/lib/supabase.ts | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/backend/src/lib/supabase.ts b/backend/src/lib/supabase.ts index da821862..51ad41ed 100644 --- a/backend/src/lib/supabase.ts +++ b/backend/src/lib/supabase.ts @@ -12,33 +12,3 @@ export function createServerSupabase() { } return createClient(url, key, { auth: { persistSession: false } }); } - -/** - * Extract and verify the Supabase JWT from the Authorization header. - * Returns the user's UUID string, or throws a Response with 401. - */ -export async function getUserIdFromRequest(req: Request): Promise { - const auth = req.headers.get("authorization") ?? ""; - if (!auth.startsWith("Bearer ")) { - throw new Response("Missing or invalid Authorization header", { - status: 401, - }); - } - const token = auth.slice(7).trim(); - - const supabaseUrl = process.env.SUPABASE_URL || ""; - const serviceKey = process.env.SUPABASE_SECRET_KEY || ""; - - if (!supabaseUrl || !serviceKey) { - throw new Response("Server auth is not configured", { status: 500 }); - } - - const admin = createClient(supabaseUrl, serviceKey, { - auth: { persistSession: false }, - }); - const { data } = await admin.auth.getUser(token); - if (!data.user) { - throw new Response("Invalid or expired token", { status: 401 }); - } - return data.user.id; -}