From 983482518460dd40d3f4a46a4f7bff7cdbb99ed9 Mon Sep 17 00:00:00 2001 From: Jesse Wierzbinski Date: Sun, 21 Apr 2024 21:36:45 -1000 Subject: [PATCH] feat(api): :bug: Change consent route from /oauth/redirect to /oauth/consent --- server/api/api/auth/login/index.ts | 2 +- server/api/oauth/callback/[issuer]/index.ts | 4 ++-- tests/oauth.test.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) 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",