From 9063de250d60f2f65fdeedfbbeb4fb29f11be120 Mon Sep 17 00:00:00 2001 From: Mikkel Jakobsen Date: Fri, 15 Nov 2024 20:14:14 +0100 Subject: [PATCH] Trying to use current url in authorizationCodeGrant --- app/auth/callback/unilogin/route.ts | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/app/auth/callback/unilogin/route.ts b/app/auth/callback/unilogin/route.ts index 644ccab0..961d8f65 100644 --- a/app/auth/callback/unilogin/route.ts +++ b/app/auth/callback/unilogin/route.ts @@ -16,23 +16,15 @@ export interface TIntrospectionResponse extends client.IntrospectionResponse { export async function GET(request: NextRequest) { const session = await getSession() const config = await getUniloginClientConfig() - const currentUrl = new URL(request.url) - const appUrl = goConfig("app.url") - const redirect_uri = `${appUrl}/auth/callback/unilogin` + const appUrl = goConfig("app.url") + const currentUrl = new URL(`${appUrl}/auth/callback/unilogin`) // Fetch all user/token info. try { - const tokenSetResponse = await client.authorizationCodeGrant( - config, - currentUrl, - { - pkceCodeVerifier: session.code_verifier, - idTokenExpected: true, - }, - { - redirect_uri, - } - ) + const tokenSetResponse = await client.authorizationCodeGrant(config, currentUrl, { + pkceCodeVerifier: session.code_verifier, + idTokenExpected: true, + }) const tokenSet = schemas.tokenSet.parse(tokenSetResponse) as TTokenSet