PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, December 28, 2021

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

 December 28, 2021     facebook, facebook-php-sdk, php     No comments   

Issue

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

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

try {
  // Returns a `Facebook\FacebookResponse` object
 $access_token= //copied from my https://developers.facebook.com/tools/explorer/
  $response = $fb->get('/me?fields=id,name', '$access_token');
} catch(Facebook\Exceptions\FacebookResponseException $e) {
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(Facebook\Exceptions\FacebookSDKException $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 ?


Solution

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.



Answered By - andyrandy
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing