From 0864c712b2b3c306ff671f6e133ea9c3278faaa1 Mon Sep 17 00:00:00 2001 From: thezzisu Date: Mon, 2 Sep 2024 03:01:32 +0800 Subject: [PATCH] chore: fix iaaa compat oauth redirect --- .yarn/versions/9636c323.yml | 2 ++ apps/server/src/routes/oauth/iaaaCompat.ts | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 .yarn/versions/9636c323.yml diff --git a/.yarn/versions/9636c323.yml b/.yarn/versions/9636c323.yml new file mode 100644 index 0000000..1a06f8b --- /dev/null +++ b/.yarn/versions/9636c323.yml @@ -0,0 +1,2 @@ +releases: + "@aoi-js/server": patch diff --git a/apps/server/src/routes/oauth/iaaaCompat.ts b/apps/server/src/routes/oauth/iaaaCompat.ts index 6b83e32..34a6e2f 100644 --- a/apps/server/src/routes/oauth/iaaaCompat.ts +++ b/apps/server/src/routes/oauth/iaaaCompat.ts @@ -23,10 +23,10 @@ export const oauthIaaaCompatRoutes = defineRoutes(async (s) => { } }, async (req, rep) => { - const url = new URL('/oauth/authorize', req.originalUrl) - url.searchParams.set('client_id', req.body.appID) - url.searchParams.set('redirect_uri', req.body.redirectUrl) - return rep.redirect(307, url.toString()) + const params = new URLSearchParams() + params.set('client_id', req.body.appID) + params.set('redirect_uri', req.body.redirectUrl) + return rep.redirect(302, '/oauth/authorize' + '?' + params.toString()) } )