Questions tagged [passport-local-mongoose]
73 questions
5
votes
1 answer
how to save multiple objects to database with passport-local-mongoose?
I want to register users to my mongoDB database using passport-local-mongoose node package, and I have no problem with that, but what I want is to add more than the username and password to the database: for example ( their first and last names,…

Dastan
- 1,929
- 2
- 10
- 21
4
votes
1 answer
how to change password using passport-local-mongoose?
I have imported the passport-local-mongoose to my code and I tried to register and log in users and all went successfuly but now I want to change the password of a specific user, how can I do that? I've read the documentation of the…

kingbeyondthewall1
- 43
- 3
3
votes
0 answers
axios withCredentials dont work in next.js
When I build MERN stack app I use axios withCredentials: true. And it work well. After I use this next.js but don't work In backend I use passport.js , passport-local-mongoose and express-session for authentication user. It don't work next.js app…

Jorakuly Atamuradow
- 49
- 5
3
votes
1 answer
Passport-local-mongoose serializeUser incorrect type
I'm trying to use Passportjs, and mongoose for authentication but I am having a hard time getting the correct type with typescript.
Passport.use(UserModel.createStrategy())
Passport.serializeUser(UserModel.serializeUser()) // <---- Error
I get the…

F22lightning
- 620
- 6
- 16
2
votes
1 answer
Passport authentication works when login, but fails when register
I am learning passport.js and session, and am trying to add a local login feature to my website.
What I was trying to do is as follows:
Secret page: When users are authenticated, they can access to the secret page, otherwise they will be transfered…

Rendrol
- 21
- 2
2
votes
2 answers
What's the difference between req.isAuthenticated() and passport.authenticate() in passport?
I am a beginner in programmation and experimenting the authentication process through node.js, express and mongoDB. I have used passport, passport-local and passport-local-mongoose to create a login/logout for users.
When my authentication succeed,…

Dev404
- 23
- 5
2
votes
0 answers
How can I make an async authenticate calls with passport-local-mongoose?
I have a working implementation with passport-local-mongoose but would like to use async/await to keep things consistent, avoid nested callbacks and be comfortable that all errors are caught and handled.
I have sorted out the register method, but am…

Russ Back
- 87
- 6
1
vote
0 answers
TypeError: user.get is not a function
I am using passport magic email verification feature (refering from https://github.com/mxstbr/passport-magic-login)
this is my code
const magicLogin = new MagicLoginStrategy({
secret: "process.env.MAGIC_LINK_SECRET",
…

Ritesh
- 27
- 5
1
vote
1 answer
passport.authenticate not authenticating the user
I am trying to register and authenticate a user using passport-local and passport-local-mongoose but the user is not getting authenticated. I do not want to downgrade my mongoose version.
This is the code for registering and authenticating a user to…

PRAKS
- 11
- 3
1
vote
2 answers
Passport Authentication Issues
I'm working with NodeJS and learning how to authenticate users and have sessions. I'm using the following packages: express-session, passport, passport-local, passport-local-mongoose
I have gone through the processes:
onst app =…

kmoakpet
- 11
- 4
1
vote
0 answers
How to use passport authentication?
I knew on GraphQL. Now I want to add user authentication using passport-local-mongoose with passport.js.
But response don't have graphql. How to solve this. Here is my solution, but this doesn't work get error: TypeError: res.end is not a function…

feruz00
- 53
- 7
1
vote
1 answer
req.isAuthenticated() returns false on other routes, passport part of session disapears
Front-end: React with React-router + axios
Back-end: express with express-session, passport, passport-local, passport-local-mongoose
I want to use 24 hour login sessions and use is.Authenticated() method from passport-local to verify if user is…

SimonBarcelona
- 33
- 5
1
vote
0 answers
Why do I get this error : Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
I am trying to create a simple registration using passsport-local and passport-jwt modules using the following code as my reister root/controller:
var passport = require('passport');
const User = require('../model/User');
const handleNewUser =…

Hasani
- 3,543
- 14
- 65
- 125
1
vote
1 answer
Passport.js Local Mongoose's setPassword not working
I am new Passport.js. I was using passport-local-mongoose making forget password API. for that I was using setPassword method as define by https://github.com/saintedlama/passport-local-mongoose.
Now this whole code is working fine. No error rises…

Shashi Kumar Fagna
- 21
- 2
1
vote
1 answer
How to delete Mongodb data located inside a model?
I am using React and Nodejs to build a note website. The npm packages I am using are:
express-session
passport
passport-local
passport-local-mongoose
My user schema looks like this-
{
"_id" : ObjectId("6267e8f8502e789211229a38"),
…

Vishal Lohar
- 51
- 1
- 5