所以我想进行身份验证,这样用户就可以通过twitter和discord进行身份验证.所以我在twitter和discord开发者门户中创建了开发者帐户.然后,我为两个社会制定了Passport 策略.作为参考,我在以下(twitter)中提供了我的战略凭据:
{
consumerKey: process.env.TWITTER_CONSUMER_KEY,
consumerSecret: process.env.TWITTER_CONSUMER_SECRET,
callbackURL: "http://localhost:9000/api/auth/twitter/callback",
includeEmail: true,
}
discord的一个类似于推特.
推特的路由包括:
router.get("/auth/discord", passport.authenticate("discord"))
router.get(
"/auth/discord/redirect",
passport.authenticate("discord"),
(req, res) => {
res.json({
success: true,
user: req.user,
})
}
)
现在我的问题是,在用户授权后,如何将用户重定向到SPA路由(React/Vue)?