1
votes

So I want to make authentication so that a user can authenticate by twitter and discord. So I created developer accounts in twitter and discord developer portal. then I made passport strategy for both socials. For reference I am providing my strategy credentials in the following(for twitter):

{
    consumerKey: process.env.TWITTER_CONSUMER_KEY,
    consumerSecret: process.env.TWITTER_CONSUMER_SECRET,
    callbackURL: "http://localhost:9000/api/auth/twitter/callback",
    includeEmail: true,
}

the discord one is similar to twitter.

Routes for twitter are:

router.get("/auth/discord", passport.authenticate("discord"))
router.get(
  "/auth/discord/redirect",
  passport.authenticate("discord"),
  (req, res) => {
    res.json({
      success: true,
      user: req.user,
    })
  }
)

Now my question is after a user authorizes, how can I redirect the user to SPA route (React/Vue)?