diff --git a/functions/api/auth/mobile/login.ts b/functions/api/auth/mobile/login.ts index 0f349ee..c3eeac4 100644 --- a/functions/api/auth/mobile/login.ts +++ b/functions/api/auth/mobile/login.ts @@ -1,7 +1,7 @@ export async function onRequestGet(_context: RequestContext) { return new Response(null, { headers: { - location: "/api/auth/oauth", + location: "/api/auth/oauth?type=mobile", }, status: 302, }); diff --git a/functions/api/auth/oauth.ts b/functions/api/auth/oauth.ts index f644ebe..9029cc2 100644 --- a/functions/api/auth/oauth.ts +++ b/functions/api/auth/oauth.ts @@ -5,6 +5,12 @@ export async function onRequestGet(context: RequestContext) { const referer = request.headers.get("referer"); if (referer) returnPath = new URL(referer).pathname; + else { + const { searchParams } = new URL(context.request.url); + + if (searchParams.get("type") === "mobile") + returnPath = "/api/auth/mobile/token"; + } const state = crypto.randomUUID().replaceAll("-", "");