Summary
Auth0 Login works with the app from the Auth0 Next.js QuickStart when using localhost, but attempting to use a custom domain by configuring the hosts file does not.
Environment
- Node Version Manager 0.39.7
- Node v18.19.0
- “@auth0/nextjs-auth0”: “^3.5.0”
How to recreate the issue
- Install Windows Subsystem for Linux Ubuntu-24.04
- Install nginx on WSL
- Follow the Auth0 quick start with Next.js to create a new app on Windows Subsystem for Linux
- Test login and logout functionality when the app is configured to use localhost (works)
- Configure nginx as reverse proxy to point to next.js app and restart nginx
- Think of a custom domain name, e.g. dev.company.com
- Update the hosts file on windows with a custom domain to point to the IP of Windows Subystem for Linux
- Reconfigure the app to use a custom domain
- Relaunch the app and attempt to test the login functionality - this might require clearing the browser history/cache. The user will get redirected to the login page, but the login process fails on the callback url with an http status code 302.
Auth0 Next.js SDK Quickstarts: Login
The only error that happens is before the login process even happens
Error: Route “/api/auth/[auth0]” used params.auth0
. params
should be awaited before using its properties. Learn more: Dynamic APIs are Asynchronous | Next.js