Closed MitulKheni-solution closed 1 year ago
this question would be better answered in the passport community.
I found all of these potential leads with a quick search for multiple strategies
Additionally, the closed issues for the same question seem to indicate this might not be possible. I suggest you do further research there.
Details
How can I combine multiple strategies in one
passport.authenticate
function?Node.js version
Not applicable.
Example code
I have 2 social authentication strategies in my Node.js app. One is Google-OAuth and another one is GitHub. There will be more strategies as well (Azure-ad and email-password).
Currently, I am using it like following:
below is the GitHub strategy:
(of course, this is not in production)
I have read a solution where I can pass the array of strategies in the
passport.authenticate
method's first argument, But that will not work as scopes are different for Google and GitHubOr I can use it only like this?
Operating system
Linux - Ubuntu
Scope
authentication, code
Module and version
passport