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

How to use local strategy on multiple Models? #170

Closed
harishankards opened this issue Apr 21, 2018 · 3 comments
Closed

How to use local strategy on multiple Models? #170

harishankards opened this issue Apr 21, 2018 · 3 comments

Comments

@harishankards
Copy link

Hi,

In my project, I'm having different models say Contractor, Purchaser and Seller. I want to authenticate them. How to configure the passport js for local strategy.

If possible, please let me know the facebook and linkedin auth also.

@xiangZgnaix
Copy link

Hey Dude! I've met the same problem recently!
To solve it, you can just instantiate two local strategies.
Something different is that you need to change the name of the instantiated strategy before you add it to the passport use middleware. Meanwhile, when you use the strategy with passport.authenticate function, the name you input is no longer the default 'local' but the name you set above!!!

@harishankards
Copy link
Author

Hey @xiangZgnaix ,

Thanks for the help. I fixed it myself in the same way mentioned above long back. Thank you!

@usamamashkoor
Copy link

Hi @xiangZgnaix and @harishankards I have implemented two local strategies but in my case
even if an admin authenticates, it gets written to req.user and when a user authenticates, it gets written to req.user.I want to get req.user and req.admin, but every time it gets written to req.user,

Can any of you help me with this, please?

Thanks

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

3 participants