Skip to content

Commit

Permalink
wip: more redirect troubleshooting
Browse files Browse the repository at this point in the history
  • Loading branch information
alishaevn committed Feb 6, 2024
1 parent 1457cb4 commit 65bd696
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pages/api/auth/[...nextauth].js
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,13 @@ const authOptions = {
* and what it expected.
* ref: https://github.com/nextauthjs/next-auth/discussions/7491#discussioncomment-6166539
*/
const clientUrl = process.env.NEXT_PUBLIC_CLIENT_BASE_URL
const urlPathname = new URL(url).pathname
console.log({
url, baseUrl, clientUrl: process.env.NEXT_PUBLIC_CLIENT_BASE_URL,
urlPathname: new URL(url).pathname, baseUrlPathname: new URL(baseUrl).pathname,
url, baseUrl, clientUrl, urlPathname,
})

// if (new URL(url).origin === process.env.NEXT_PUBLIC_CLIENT_BASE_URL) return url
if (new URL(url).origin === process.env.NEXT_PUBLIC_CLIENT_BASE_URL) return `${clientUrl}${urlPathname}`
// return baseUrl
return url

Expand Down

0 comments on commit 65bd696

Please sign in to comment.