Skip to content
Advertisement

Graph returned an error: Invalid appsecret_proof provided in the API argument

i am using facebook PHP sdk (v4) to fetch user information, after installing SDK, i add the code

$fb = new FacebookFacebook([
  'app_id' => 'my app id',
  'app_secret' => 'my app secret',
  'default_graph_version' => 'v2.5',
]);

try {
  // Returns a `FacebookFacebookResponse` object
 $access_token= //copied from my https://developers.facebook.com/tools/explorer/
  $response = $fb->get('/me?fields=id,name', '$access_token');
} catch(FacebookExceptionsFacebookResponseException $e) {
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(FacebookExceptionsFacebookSDKException $e) {
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}

$user = $response->getGraphUser();

echo 'Name: ' . $user['name'];

but when i run the page it gives me this error,

Graph returned an error: Invalid appsecret_proof provided in the API argument

i am copying the app secret correctly, what could be the reason for such error and how should i fix this ?

Advertisement

Answer

You may want to read this: https://developers.facebook.com/docs/graph-api/securing-requests

appsecret_proof is a separate parameter that is generated by using the App Secret, but it is NOT the App Secret. Information about how to generate it can be found in the docs.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement