A
A
Alexey Shashenkov2017-05-28 14:09:09
In contact with
Alexey Shashenkov, 2017-05-28 14:09:09

How to link different strategies using passportjs?

I want to link different login methods for one user. But I can't link them. The problem is that it is not clear at the time of entry whether the user is logged in or not. Now I want to link LocalStrategy and VKontakteStrategy. Checking at the route level is somehow stupid. But I can’t get status data before serializeUser in the strategy (well, or I didn’t find how). In general, you need to how to link different login methods for the 1st user

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Shashenkov, 2017-05-31
@teknik2008

Since no one suggested. I'll tell you how I did it.
1) Included in the strategy 2) In the callback root, I put a property with the user id in the request object. 3) In the strategy handler, I received the request object and retrieved the id 4) Further, the actual behavior from the presence of id passReqToCallback: true

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question