diff --git a/server/api/api/auth/login/index.ts b/server/api/api/auth/login/index.ts index f22ad38f..b05c015d 100644 --- a/server/api/api/auth/login/index.ts +++ b/server/api/api/auth/login/index.ts @@ -150,7 +150,7 @@ export default apiRoute(async (req, matchedRoute, extraData) => { // Redirect to OAuth authorize with JWT return response(null, 302, { Location: new URL( - `/oauth/redirect?${searchParams.toString()}`, + `/oauth/consent?${searchParams.toString()}`, config.http.base_url, ).toString(), // Set cookie with JWT diff --git a/server/api/oauth/callback/[issuer]/index.ts b/server/api/oauth/callback/[issuer]/index.ts index 9ed8b7a6..76e28fdb 100644 --- a/server/api/oauth/callback/[issuer]/index.ts +++ b/server/api/oauth/callback/[issuer]/index.ts @@ -177,8 +177,8 @@ export default apiRoute(async (req, matchedRoute, extraData) => { // Redirect back to application return Response.redirect( - `/oauth/redirect?${new URLSearchParams({ - redirect_uri: flow.application.redirectUris, + `/oauth/consent?${new URLSearchParams({ + redirect_uri: flow.application.redirectUri, code, client_id: flow.application.clientId, application: flow.application.name, diff --git a/tests/oauth.test.ts b/tests/oauth.test.ts index 7b97b838..d97f8aac 100644 --- a/tests/oauth.test.ts +++ b/tests/oauth.test.ts @@ -84,7 +84,7 @@ describe("POST /api/auth/login/", () => { "", ); - expect(locationHeader.pathname).toBe("/oauth/redirect"); + expect(locationHeader.pathname).toBe("/oauth/consent"); expect(locationHeader.searchParams.get("client_id")).toBe(client_id); expect(locationHeader.searchParams.get("redirect_uri")).toBe( "https://example.com",