I have inherited an app that I am trying to get to work and having trouble. The app uses React, Node, and Passport. My understanding of the workflow is as follows:
- user clicks “login” in the React app
- React calls /login/auth0 on my Node server
- my Node server calls Auth0
- Auth0 authenticates the user
- Auth0 returns to my Node server using the callback url
Step 4 above works, because I am successfully redirected to the Auth0 login screen and can login.
Step 5 is where I run into the issue - I get redirected back to the server and can debug a breakpoint where it hits (in my postAuthenticationRouter.js) and I can see that
req.session.passport.user is undefined).
I have tried some pieces of debugging and I am totally stuck. At this point, I am thinking of maybe trying to look at the req object to maybe find some clues that could indicate what is missing or going wrong. What I see of
req.session is the following:
Where in that object is the authenticated user’s information supposed to be?
As far as I can tell, the Auth0 part is happening correctly, since it redirects me back to my app. I am confused though, because as far as I can tell, the response from Auth0 is not coming back with anything.
Alternatively, does anyone have a tip of where I could put a breakpoint on my server to see the response coming from Auth0 to just spot check that it has the information about the user?
Thank you so much for the help! Please let me know if I can provide any other details!