Authentication failing after calling back from Auth0 with Passport.js


I’m making a web app with Node.js and using Passport.js and Auth0 for authentication. I’ve got all my authentication routes in a file routes/auth.js and when I go to /auth/ to login it takes me to Auth0 where I login and get redirected back to /auth/callback?code=...&state=... Passport.js then redirects to the fail page without an error and without calling the passport.use(new Auth0Strategy(config.auth0, (accessToken, refreshToken, extraParams, profile, done) => { ... })); function. However, this is only when I put it into a docker container on a server, and it works completely fine on my local machine with the exact same configuration (with the exception of a reverse proxy).

My authentication code and a section of my logs are on a gist here.

I’d really appreciate any help and hopefully I can get this sorted :slight_smile:

P.S If I missed out any important code or anything like that I’m happy to share.

Hey there @jake-walker, I apologize for the delay in response.

I understand this question was asked quite some time ago but if you are still facing this issue I would be happy to give it a look. One thing that can help our investigation is when you are experiencing the broken workflow to capture a HAR file. This would allow us to follow the Authentication flow and see where the breakdown is happening. Please be sure to select “Preserve log” to catch redirects and scrub the file of user passwords before passing it over in direct message.

Due to the age of this topic I will keep it open for another ten days just in case you have any lingering questions on this subject. Thanks!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.