diff --git a/packages/adapter-nextjs/src/oauth/utils/completeOAuthFlow.ts b/packages/adapter-nextjs/src/oauth/utils/completeOAuthFlow.ts index acdde9769f7..fa191f21992 100644 --- a/packages/adapter-nextjs/src/oauth/utils/completeOAuthFlow.ts +++ b/packages/adapter-nextjs/src/oauth/utils/completeOAuthFlow.ts @@ -44,9 +44,7 @@ export const completeOAuthFlow = async ({ const oAuthTokenEndpoint = `https://${oAuthConfig.domain}/oauth2/token`; - const response = NextResponse.redirect( - new URL(redirectOnComplete, request.url), - ); + const response = NextResponse.redirect(new URL(redirectOnComplete, origin)); const keyValueStorage = createKeyValueStorageFromCookieStorageAdapter( createCookieStorageAdapterFromNextServerContext({