【问题标题】:Passport does not send scopes护照不发送范围
【发布时间】:2019-09-20 17:09:46
【问题描述】:

我确实将电子邮件作为范围传递,如下所示:

router.get(keys.facebookCallbackURL, passport.authenticate('facebook', {
    scope: ['public_profile', 'email'], 
    failureRedirect: '/', 
    session: false }),
    (req, res) => {
        //...
    }
);

生成的网址是:

https://www.facebook.com/v3.2/dialog/oauth?response_type=code&redirect_uri=https%3A%2F%2Flocalhost%3A5000%2Fauth%2Ffacebook%2Fcallback&client_id=123977854776367

它不会要求用户授予电子邮件,但是当我手动将 &scope=email%2Cpublic_profile 附加到 url 时它会这样做。

像这样:

https://www.facebook.com/v3.2/dialog/oauth?response_type=code&redirect_uri=https%3A%2F%2Flocalhost%3A5000%2Fauth%2Ffacebook%2Fcallback&client_id=123977854776367&scope=email%2Cpublic_profile

为什么范围没有附加到 url?

【问题讨论】:

    标签: express passport-facebook


    【解决方案1】:

    我在错误的路线上添加了范围。

    router.get(
      "/auth/google",
      passport.authenticate("google", {
        scope: ["profile", "email"]
      })
    );
    

    【讨论】:

      猜你喜欢
      • 2017-01-19
      • 1970-01-01
      • 2019-10-24
      • 1970-01-01
      • 2017-12-08
      • 2017-07-15
      • 2015-03-16
      • 2016-12-24
      • 1970-01-01
      相关资源
      最近更新 更多