我使用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.
如何传递页面访问令牌?或者这与其他事情有关吗?
答案 0 :(得分:1)
我发现了这个问题。这与Access令牌无关。我的一些profileFields参数无效。修改后的工作代码如下:
new FacebookStrategy(
{
clientID: authConfig.facebookAuth.clientID,
clientSecret: authConfig.facebookAuth.clientSecret,
callbackURL: authConfig.facebookAuth.callbackURL,
profileFields: [
"id",
"displayName",
"email",
"gender",
"picture.type(large)"
]
}