Auth0 Home Blog Docs

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.