Answer the question
In order to leave comments, you need to log in
Why is the Facebook API request not working?
Hello!
I am using Facebook PHP SDK v5 . When this code is executed
require_once __DIR__.'includes/facebook/src/Facebook/autoload.php';
$fb = new Facebook\Facebook([
'app_id' => $fb_app_id,
'app_secret' => $fb_app_secret
]);
$fb->setDefaultAccessToken($fb_access_token);
echo '<pre>';
print_r($fb->get('/me'));
echo '</pre>';
Fatal error: Uncaught exception 'Facebook\Exceptions\FacebookAuthenticationException' with message 'Invalid appsecret_proof provided in the API argument' in path/includes/facebook/src/Facebook/Exceptions/FacebookResponseException.php:100
Stack trace:
#0 path/includes/ facebook/src/Facebook/FacebookResponse.php(210): Facebook\Exceptions\FacebookResponseException::create(Object(Facebook\FacebookResponse))
#1 path/includes/facebook/src/Facebook/FacebookResponse.php(255): Facebook\ FacebookResponse->makeException()
#2 path/includes/facebook/src/Facebook/FacebookResponse.php(82): Facebook\FacebookResponse->decodeBody()
#3 path/includes/facebook/src/Facebook/FacebookClient.php(225): Facebook\FacebookResponse->__construct(Object(Facebook\FacebookRequest), '{"error":{"mess...', 400, Array )
#4 path /includes/facebook/src/Facebo in path/includes/facebook/src/Facebook/Exceptions/FacebookResponseException.php on line 100
print_r($fb->get('/me', hash_hmac('sha256', $fb_access_token, $fb_app_secret)));
Fatal error: Uncaught exception 'Facebook\Exceptions\FacebookAuthenticationException' with message 'Invalid OAuth access token.' in path/includes/facebook/src/Facebook/Exceptions/FacebookResponseException.php:100
Stack trace:
#0 path/includes/facebook/src/Facebook/FacebookResponse.php(210): Facebook\Exceptions\FacebookResponseException::create(Object (Facebook\FacebookResponse))
#1 path/includes/facebook/src/Facebook/FacebookResponse.php(255): Facebook\FacebookResponse->makeException()
#2 path/includes/facebook/src/Facebook/FacebookResponse.php(82 ): Facebook\FacebookResponse->decodeBody()
#3 path/includes/facebook/src/Facebook/FacebookClient.php(225): Facebook\FacebookResponse->__construct(Object(Facebook\FacebookRequest), '{"error":{ "mess...
#4 path/includes/facebook/src/Facebook/Facebook.php(504): Fac in path/includes/facebook/src/Facebook/Exceptions/FacebookResponseException.php on line 100
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question