Loop between login and callback causing ERR_TOO_MANY_REDIRECTS

Hi, my application uses Next.js with Express and I have implemented the Auth0 strategy according to the quick start for regular web applications with NodeJS. In my development environment the implementation works well and I am allowed to make login without problems. The problem is that in production environment there is a loop between /login and /callback urls causing the error ERR_TOO_MANY_REDIRECTS. In some way, the /login knows that I am logged and redirects me to the /callback url, but this doesn’t receive the ‘user’ and redirects back to /login, causing the loop. Any help will be appreciated.

Hi Claudio,

Without more info, I don’t think we can help much. Try using “developer tools” and following the network traffic, to see if you can identify what is wrong, or to get more info to post here.


And make sure to share with us your findings, screenshots etc here

Hello @claudiocfls ,

Try adding app.set("trust proxy", 1); to you app.js file

1 Like

Thanks for sharing it with the rest of community!