Skip to content

Configure passport strategy with multiple issuers #624

Discussion options

You must be logged in to vote

You will eventually have to call passport.authenticate middleware on some endpoint in your app.
Here is a nice description on how to do this with multiple strategies.
Now back to your case, you just need to name them differently and do passport.use twice during app init.

// Create two issuers, two clients, two strategies then:
passport.use('oidc-domain-a', strategyA);
passport.use('oidc-domain-b', strategyB);

Then on some endpoint:

router.post('/login',
   passport.authenticate(['oidc-domain-a', 'oidc-domain-b']),
  (req, res) => {
     // now you have a token which comes from either A or B domain oidc provider
  }

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@eugeniosegala
Comment options

Answer selected by eugeniosegala
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants