Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 321
Nimish David Mathew Avatar asked Sep 15 '25 09:09

Nimish David Mathew


1 Answers

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)"
        ]
      }
like image 57
Nimish David Mathew Avatar answered Sep 18 '25 10:09

Nimish David Mathew