Passport authenticated fail when redirect (req.user undefined) #994
Unanswered
Tohru-TheTofu
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I'm very new to web development and I'm struggling about what I do wrong here. My project have a issues when I need to find documents that have a same type with the user who log in. The first few times seem to work fine but now I'm getting a problem that req.user was undefined. When using Morgan to check, I fought that when I send the API to GET the data, isAuthenticated() turn to false and req.user was undefined. I'll show my work down, thank you so much for helping me because I did tons of research for a few days and felling so exhausted <3:
In Index.js file, I think I called everything I need (or not)
`
The passport config like Stratergy, serialize or deserialize work fine in other senarios so I think I dont need to quote it here
And then I have a controller file to handle the method:
A router file to set up routes, here test is a ejs file and table is the API to get the method in the controller file above:
The service.testRoutes above is actually exports from this:
Beta Was this translation helpful? Give feedback.
All reactions