简体   繁体   中英

Facebook Graph-api, premissions for Shares count (Invalid OAuth access token signature)

I am far from the programming and PHP, but got the challenge to get the Fb share count for the website :)

I'm trying to get the proper App Access Token and send the request to Fb according to this article .

The request should be like this:

https://graph.facebook.com/?ids=http://www.myurl.com/my-page&access_token=myappid|myappsecret

And I getting this error.

   {
       "error": {
          "message": "Invalid OAuth access token signature.",
          "type": "OAuthException",
          "code": 190,
          "fbtrace_id": "FfZKAkCyad1"
       }
    }

I am going to use it in PHP roughly like this:

function facebook_count($url)
{
$results = @file_get_contents('http://graph.facebook.com/' . $url .'&access_token=myappid|myappsecret');
if ($results) {
$like_array = json_decode($results, true);
if (!empty($like_array['shares']))
return ($like_array['shares']);
}

return 0;
}

My guess, I checked wrong Permissions (scopes) for my App token. Did not found an answer in FB dev page. Checked this for now:

user_likes, read_insights, read_audience_network_insights, public_profile

What Scope do I need to check, if I need only the shares count by the link?
Or in what else could be the problem?

You need to use an App Access Token ... So the actual permissions (referring to User Access Tokens !) are irrelevant.

So, hopefully you are replacing myappid|myappsecret with your actual App Id and App Secret. If ynot, there's your error. Furthermore, I think in the file_get_contents call then ?id= part in the URL is missing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM