E
E
enriko182016-03-21 17:43:39
JavaScript
enriko18, 2016-03-21 17:43:39

Authorization through social networks?

Guys, I'm interested in the question of how to implement social network login bypassing passport.js. All examples and libs use it, but the fact is that the site has already implemented authorization by tokens (node.js + express + react), and the token itself is subsequently stored in cookies. When a user registers, a corresponding entry is created in the database table (email, password, and so on). It would be easier to simply fasten the login buttons through the social network, where I would create this very entry on the server and insert the email received through this widget. And in the future it would be a single account and it would be possible to log in both via email and through different social networks (after all, they will have a common email)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Konstantin Kitmanov, 2016-03-21
@k12th

Well, in principle, if you write the right callbacks, then you can achieve the integration of passportjs with a ready-made system. The token is stored in cookies in any, probably, authorization system :)
Another option is to remake local authorization to passportjs, this should not take much time, and everything is configured there quite flexibly, emnip.
The third option is to smoke the OAuth / 2 docks and write it yourself.

D
Dmitry Skryabin, 2016-03-22
@SkryabinD

I don’t know your code, but at first glance, you can still try to do it on passportjs. There is a callback that searches for a user - there you will search for a user in your table and add a new user. And there is a callback (which is in the route in the examples), which is executed in case of successful authorization. You can put your existing token authorization in it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question