Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auth0 Provider ignores NEXTAUTH_URL (with basePath) in prod #11935

Open
ss-ravi opened this issue Oct 1, 2024 · 0 comments
Open

Auth0 Provider ignores NEXTAUTH_URL (with basePath) in prod #11935

ss-ravi opened this issue Oct 1, 2024 · 0 comments
Labels
bug Something isn't working providers triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.

Comments

@ss-ravi
Copy link

ss-ravi commented Oct 1, 2024

Provider type

Auth0

Environment

  System:
    OS: macOS 14.5
    CPU: (10) arm64 Apple M2 Pro
    Memory: 548.75 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.18.2 - ~/.nvm/versions/node/v18.18.2/bin/node
    Yarn: 1.22.22 - ~/.nvm/versions/node/v18.18.2/bin/yarn
    npm: 9.8.1 - ~/.nvm/versions/node/v18.18.2/bin/npm
    pnpm: 8.15.3 - ~/.nvm/versions/node/v18.18.2/bin/pnpm
  Browsers:
    Chrome: 129.0.6668.60
    Safari: 17.5
  npmPackages:
    next: 14.2.13 => 14.2.13 
    next-auth: ^4.24.8 => 4.24.8 
    react: ^18 => 18.3.1 

Reproduction URL

https://github.com/ss-ravi/auth0-provider-test

Describe the issue

after the auth0 sign in, the browser is being redirected to https://my-app.vercel.app/api/auth/callback/auth0 even though my NEXTAUTH_URL is set to https://my-app.vercel.app/app/api/auth.
In localhost it works as expected and the app redirects to http://localhost:3000/app/api/auth/callback/auth0.

How to reproduce

  • Clone the repo
  • Set it up to deploy on Vercel
  • set the environment variables:
    • NEXT_PUBLIC_BASE_PATH=/app
    • AUTH0_CLIENT_ID=xxx
    • AUTH0_CLIENT_SECRET=xxx
    • AUTH0_ENDPOINT=https://xxx.com
    • NEXTAUTH_URL=https://my-app.vercel.app/app/api/auth (switch to your app's Vercel domain)
    • NEXTAUTH_SECRET=xxx
  • deploy the app
  • the callbackUrl will not include the basePath and it will show 404

Expected behavior

The callbackUrl should include the basePath (as it is set in the NEXTAUTH_URL)

Additional info

I also tried to set the redirectUri manually, but without success: commit

Relevant code

@ss-ravi ss-ravi added bug Something isn't working providers triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime. labels Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working providers triage Unseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.
Projects
None yet
Development

No branches or pull requests

1 participant