Skip to content

Commit 75594e2

Browse files
committed
fix: removed port from the current url in production
1 parent 299816c commit 75594e2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/src/app/auth/openiddict/route.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@ export async function GET(request: NextRequest) {
1010
const session = await getSession()
1111
const openIdClientConfig = await getClientConfig()
1212
const currentUrl = new URL(request.url)
13-
currentUrl.host = (await headers()).get('host')!
13+
const headersList = await headers()
14+
currentUrl.host = headersList.get('host')!
15+
// remove the port if it exists in the host only in production
16+
if (process.env.NODE_ENV === 'production') {
17+
currentUrl.host = currentUrl.host.split(':')[0]
18+
}
1419
const tokenSet = await client.authorizationCodeGrant(openIdClientConfig, currentUrl, {
1520
pkceCodeVerifier: session.code_verifier,
1621
expectedState: session.state

0 commit comments

Comments
 (0)