Skip to main content

All Questions

Tagged with
485 votes
7 answers
200k views

Understanding passport serialize deserialize

How would you explain the workflow of Passport's serialize and deserialize methods to a layman. Where does user.id go after passport.serializeUser has been called? We are calling passport....
Anubhav's user avatar
  • 7,188
134 votes
17 answers
308k views

ERR_HTTP_HEADERS_SENT: Cannot set headers after they are sent to the client

I'm facing this weird issue in NodeJS when using with Passport.js, Express and Mongoose. Basically, I get an error saying "Cannot set headers after they are sent to the client" even though I don't ...
lourdesr's user avatar
  • 1,451
90 votes
29 answers
123k views

Node + Express + Passport: req.user Undefined

My question is similar to this one, but there was no insight into his solution. I'm using Passport to auth using Instagram. After successful auth, users are directed to "/". At this point, the ...
gojohnnygo's user avatar
  • 1,148
14 votes
3 answers
33k views

Model.find().toArray() claiming to not have .toArray() method

I am very new to Node.js and MongoDB and am trying to piece together my own blogging application. I have a problem trying to query through my 'Blog' model for ones with a specific username. When I try ...
Rorschach120's user avatar
  • 1,210
61 votes
21 answers
62k views

passport's req.isAuthenticated always returning false, even when I hardcode done(null, true)

I'm trying to get my Passport local strategy working. I've got this middleware set up: passport.use(new LocalStrategy(function(username, password, done) { //return done(null, user); if (...
CodyBugstein's user avatar
  • 22.9k
217 votes
6 answers
122k views

How to implement a secure REST API with node.js

I start planning a REST API with node.js ,express and mongodb. The API provides data for a website (public and private area) and maybe later a mobile app. The frontend will be developed with AngularJS....
tschiela's user avatar
  • 5,271
117 votes
7 answers
104k views

Redirecting to previous page after authentication in node.js using passport.js

I'm trying to establish a login mechanism using node.js, express and passport.js. The Login itself works quite nice, also sessions are stored nicely with redis but I do have some troubles with ...
Alx's user avatar
  • 6,285
118 votes
8 answers
92k views

passport.js passport.initialize() middleware not in use

I am using node with express + mongoose and trying to use passport.js with restful api. I keep getting this exception after authentication success (I see the callback url on the browser): /Users/...
Naor's user avatar
  • 23.8k
79 votes
30 answers
84k views

Why is PassportJS in Node not removing session on logout

I am having trouble getting my system to log out with PassportJS. It seems the logout route is being called, but its not removing the session. I want it to return 401, if the user is not logged in in ...
Jeffrey Chen's user avatar
  • 1,059
158 votes
3 answers
50k views

passport.js RESTful auth

How does one handle authentication (local and Facebook, for example) using passport.js, through a RESTful API instead of through a web interface? Specific concerns are handling the passing of data ...
ryanrhee's user avatar
  • 2,571
108 votes
2 answers
49k views

Using PassportJS, how does one pass additional form fields to the local authentication strategy?

I'm using passportJS and I'm wanting to supply more than just req.body.username and req.body.password to my authentication strategy (passport-local). I have 3 form fields: username, password, & ...
k00k's user avatar
  • 17.5k
76 votes
8 answers
44k views

How to authenticate Supertest requests with Passport?

I'm using Passport.js for authentication (local strategy) and testing with Mocha and Supertest. How can I create a session and make authenticated requests with Supertest?
Gal Ben-Haim's user avatar
  • 17.7k
51 votes
5 answers
31k views

Use multiple local strategies in PassportJS

I'm trying to use multiple LOCAL strategies with PassportJS. I'm not trying to use local, facebook, and gmail, etc. I have two sets of users stored in separate objects and I want to use a local ...
Plattaz's user avatar
  • 525
115 votes
6 answers
101k views

How to know if user is logged in with passport.js?

I've been reading passport.js info and samples for two days, but I'm not sure after that I did all the process of authenticating. How do I know if I'm logged in, for example, I'll have a navigation ...
RMontes13's user avatar
  • 2,148
83 votes
1 answer
91k views

How is req.isAuthenticated() in Passport JS implemented? [closed]

In passportJS Documentation, I think passport isAuthenticated function not documented well. How is req.isAuthenticated() in PassportJS implemented?
Kim's user avatar
  • 1,081

15 30 50 per page
1
2 3 4 5
31