nextauthjs / next-auth

Authentication for the Web.
https://authjs.dev
ISC License
24.86k stars 3.51k forks source link

In `pages router` mode, when deployed to vercel, the callbackUrl is `vercel_url`, not `nextauth_url` #8556

Open kjxbyz opened 1 year ago

kjxbyz commented 1 year ago

Environment

  System:
    OS: macOS 13.5.2
    CPU: (6) x64 Intel(R) Core(TM) i5-8500 CPU @ 3.00GHz
    Memory: 10.68 GB / 64.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.17.1 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 9.6.7 - /usr/local/bin/npm
    Watchman: 2023.08.14.00 - /usr/local/bin/watchman
  Browsers:
    Chrome: 116.0.5845.179
    Safari: 16.6

Reproduction URL

https://github.com/cyf/cyf-insider

Describe the issue

In pages router mode, when deployed to vercel, the callbackUrl is vercel_url, not nextauth_url

How to reproduce

  1. clone code
  2. git checkout 038a250b
  3. yarn install
  4. yarn dev

Expected behavior

In pages router mode, when deployed to vercel, the callbackUrl is nextauth_url

NikitaKlimuk commented 11 months ago

Has there been any success in resolving this issue? I have a similar situation, when changing the default api/auth roots for example to /next/api/auth. On the prod version google provider does not work correctly

redirect_uri=.../api/auth/callback/google instead of .../next/api/auth/callback/google