question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

passport middleware, no req.login on context

See original GitHub issue

Hi! Thanks for this awesome package! I can’t figure out how to attach passports login to request. I do initialize it on

server.express.use(passport.initialize());

and my express req function still doesn’t have a login on it… I was wondering is there a sequence that I should have to arrange the middleware or any advice would be great! thanks

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
mwilc0xcommented, Jul 19, 2018

Ok I think I have something working here if you want to see, I am not sure how you had yours setup but I am doing a simple passport oauth with a third party service. I’m taking the authentication creds off the request and passing those into the graphql context which get passed to the resolver functions who can use them to interact with the service.

One thing to note is to make sure cookies are being sent properly from the client to the server, otherwise the auth data will not be populated on the request object.

Here is a gist of the server code that I have working:

https://gist.github.com/mjw56/5e5211b327175737b7ce1df0eadf1e01

0reactions
davidaleknacommented, Oct 16, 2018

hey guys this is no more relevant to me so I’m closing this issue. Please open a new one if you still having issues.

Read more comments on GitHub >

github_iconTop Results From Across the Web

passport middleware, no req.login on context #355 - GitHub
I'm taking the authentication creds off the request and passing those into the graphql context which get passed to the resolver functions who...
Read more >
Node + Express + Passport: req.user Undefined - Stack Overflow
It's successfully getting the user object, but somewhere along the middleware road, req.user is not being set (or being unset). // on successful ......
Read more >
Documentation: Middleware - Passport.js
Passport is used as middleware within a web application to authenticate ... the req.user property is set to the authenticated user, a login...
Read more >
Node.js Authentication Tutorial with Passport
Learn how to handle web authentication and authorization in Node using Passport.js. Create signup and login page, different types of users ...
Read more >
Authenticate Users with Passport and express-session
On top of express-session and passport. So before firing up, I'm hoping you all know how to set up a basic app in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found