diff options
Diffstat (limited to 'src/routes/passkey')
| -rw-r--r-- | src/routes/passkey/[...path]/+server.ts | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/routes/passkey/[...path]/+server.ts b/src/routes/passkey/[...path]/+server.ts index 0f94c605..0c2154d2 100644 --- a/src/routes/passkey/[...path]/+server.ts +++ b/src/routes/passkey/[...path]/+server.ts @@ -3,9 +3,16 @@ import { auth } from "$lib/utils"; export async function POST({ cookies, fetch, params, request, url }) { const { path } = params; - const token = cookies.get("token"); const headers: Record<string, string> = { "Content-Type": "application/json" }; - if (token) Object.assign(headers, auth(cookies)); + + // Use Authorization header from request if present, otherwise fall back to cookie + const authHeader = request.headers.get("authorization"); + if (authHeader) { + headers.authorization = authHeader; + } else { + const token = cookies.get("token"); + if (token) Object.assign(headers, auth(cookies)); + } const body = await request.json(); body.origin = url.origin; |
