Wednesday 30 March 2016

Using sessions in a node/passport.js authentication setup?

I'm using passport.js to authenticate users in my ionic/angular frontend node backend app. I am logging people in through Facebook using passport, but then I want to be able to authenticate users with Stripe once they are already logged in.The initial FB log in works fine, but for the Stripe login I was advised to use sessions (can this be done without a session?).My serializeUser function gets called, but when the callback comes back from Stripe in to this functionpassport.use(new StripeStrategy(config.stripe, function(req, accessToken, refreshToken, stripe_properties, done) { DeserializeUser is never called.req.user is undefinedreq.sessionStore.sessions has all the sessions created so farreq.sessionID is a reference to an empty session that I can see in the sessionStore (this ID always seems to stay the same)All I want is to be able to get the id of the user associated with that session, or at least be able to match the session that is coming back with the callback to the correct existing session.Anyone have any ideas where I am going wrong? Or has come across this before?I don't wanna spam a load of code, but I can provide any of what I have done so far. Any help would be greatly appreciated! Thanks

Submitted March 30, 2016 at 09:08PM by monsterChomper

No comments:

Post a Comment