# Loop between login and callback causing ERR\_TOO\_MANY\_REDIRECTS

**URL:** <https://community.auth0.com/t/loop-between-login-and-callback-causing-err-too-many-redirects/36268>\
**Category:** Get Help\
**Created:** [January 14, 2020, 3:16am UTC](https://community.auth0.com/t/loop-between-login-and-callback-causing-err-too-many-redirects/36268 "2020-01-14T03:16:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![claudiocfls](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/claudiocfls/32/13280_2.png) [@claudiocfls](https://community.auth0.com/u/claudiocfls)\
**Post date:** [January 14, 2020, 3:16am UTC](https://community.auth0.com/t/loop-between-login-and-callback-causing-err-too-many-redirects/36268/1 "2020-01-14T03:16:49Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![john.gateley](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/john.gateley/32/10879_2.png) [@john.gateley](https://community.auth0.com/u/john.gateley)\
**Post date:** [January 14, 2020, 5:55pm UTC](https://community.auth0.com/t/loop-between-login-and-callback-causing-err-too-many-redirects/36268/2 "2020-01-14T17:55:00Z")

</div>

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.

John

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [January 15, 2020, 9:54am UTC](https://community.auth0.com/t/loop-between-login-and-callback-causing-err-too-many-redirects/36268/3 "2020-01-15T09:54:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![kristian.arsov](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/kristian.arsov/32/32556_2.png) [@kristian.arsov](https://community.auth0.com/u/kristian.arsov)\
**Post date:** [October 24, 2021, 11:43pm UTC](https://community.auth0.com/t/loop-between-login-and-callback-causing-err-too-many-redirects/36268/4 "2021-10-24T23:43:19Z")

</div>

Hello @claudiocfls ,

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

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [October 25, 2021, 7:31am UTC](https://community.auth0.com/t/loop-between-login-and-callback-causing-err-too-many-redirects/36268/5 "2021-10-25T07:31:06Z")

</div>

Thanks for sharing it with the rest of community!
