I am using Passport-Facebook strategy for authentication. Please find the code below:
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) {
This is giving me the following error:
FacebookGraphAPIError: (#210) This call requires a Page access token.
How do I pass the page access token? Or is this related to something else?
I have found the problem. This had nothing to do with the Access token. Some of my profileFields parameters were invalid. The modified, working code is given below:
new FacebookStrategy(
{
clientID: authConfig.facebookAuth.clientID,
clientSecret: authConfig.facebookAuth.clientSecret,
callbackURL: authConfig.facebookAuth.callbackURL,
profileFields: [
"id",
"displayName",
"email",
"gender",
"picture.type(large)"
]
}