【问题标题】:FacebookGraphAPIError: (#210) This call requires a Page access tokenFacebookGraphAPIError: (#210) 此调用需要页面访问令牌
【发布时间】:2018-09-01 04:02:19
【问题描述】:

我正在使用 Passport-Facebook 策略进行身份验证。请在下面找到代码:

new FacebookStrategy(
      {
        clientID: authConfig.facebookAuth.clientID,
        clientSecret: authConfig.facebookAuth.clientSecret,
        callbackURL: authConfig.facebookAuth.callbackURL,
        profileURL: "https://graph.facebook.com/v2.10/me",
        authorizationURL: "https://www.facebook.com/v2.10/dialog/oauth",
        tokenURL: "https://graph.facebook.com/v2.10/oauth/access_token",
        profileFields: ["email", "profile_pic", "gender"]
      },
      function(accessToken, refreshToken, profile, done) {

这给了我以下错误:

FacebookGraphAPIError: (#210) This call requires a Page access token.

如何传递页面访问令牌?还是这与其他事情有关?

【问题讨论】:

  • 发生这种情况时,您实际尝试进行什么 API 调用?以上似乎只是配置?
  • 这是他们在 Passport-Facebook 文档中所说的:Passport strategy for authenticating with Facebook using the OAuth 2.0 API.

标签: node.js facebook-graph-api passport.js passport-facebook


【解决方案1】:

我发现了问题。这与访问令牌无关。我的一些 profileFields 参数无效。修改后的工作代码如下:

new FacebookStrategy(
      {
        clientID: authConfig.facebookAuth.clientID,
        clientSecret: authConfig.facebookAuth.clientSecret,
        callbackURL: authConfig.facebookAuth.callbackURL,
        profileFields: [
          "id",
          "displayName",
          "email",
          "gender",
          "picture.type(large)"
        ]
      }

【讨论】:

  • 谢谢老兄!不知道为什么在 API 4.0 上它仍然是一个错误
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2013-05-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-07-14
  • 2018-03-20
  • 2011-10-11
相关资源
最近更新 更多