Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to retrieve req.user.id app.post("/submit") #22

Open
Sakthilab opened this issue May 22, 2022 · 3 comments
Open

Unable to retrieve req.user.id app.post("/submit") #22

Sakthilab opened this issue May 22, 2022 · 3 comments

Comments

@Sakthilab
Copy link

when i try to click submit the secret it is not getting the user id

when i checked using console.log(req.user.id) it is showing "undefined"

facing isse with app.post("/submit")

@DerekGray2022
Copy link

I had this the same problem with app.post("/submit). It turned out to be an error with my submittedSecret constant.

I had => const submittedSecret = req.body.submit;
when I should've had => const submittedSecret = req.body.secret;

This may (or may not) be the same issue you're getting.

@regan-mu
Copy link

Another cause for the problem would be returning the user id during serialization:
passport.serializeUser(function(user, cb) { process.nextTick(function() { return cb(null, { id: user.id, username: user.username }); }); });
Read More Here => https://www.passportjs.org/concepts/authentication/sessions/

@yourHighness11
Copy link

when i try to click submit the secret it is not getting the user id

when i checked using console.log(req.user.id) it is showing "undefined"

facing isse with app.post("/submit")

just use console.log(req.user) you will get the id of the user.....

and copy the sessions from the link given below:-

https://www.passportjs.org/concepts/authentication/downloads/html/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants