Error: Graph returned an error: Invalid appsecret_proof provided in the API argument (SDK PHP FACEBOOK) -
i tried follow example: https://github.com/facebook/php-graph-sdk when run in browser: http://192.168.33.10/fb_api/firstapp.php/, error: graph returned error: invalid appsecret_proof provided in api argument. checked app_id , app_scret. source code:
<!doctype html> <html> <head> <title>first app</title> <meta charset="utf-8"> </head> <body> <?php $access_token = 'eaacedeose0cbabaxt3vjdmuig8h5dq8dhju....'; $app_secret = '98680d3e6a251b52d87d...'; $appsecret_proof= hash_hmac('sha256', $access_token, $app_secret); require "phpsdk/src/facebook/autoload.php"; $fb = new facebook\facebook([ "app_id" => '11651982...', "app_secret" => '98680d3e6a251b52d87...', 'default_graph_version' => 'v2.10', ]); try { // \facebook\graphnodes\graphuser object current user. // if provided 'default_access_token', '{access-token}' optional. $response = $fb->get('/me', 'eaacedeose0cbabaxt3vjdmuig8h5dq8dhjuzb12phbyc2zb0g....'); } catch(\facebook\exceptions\facebookresponseexception $e) { // when graph returns error echo 'graph returned error: ' . $e->getmessage(); exit; } catch(\facebook\exceptions\facebooksdkexception $e) { // when validation fails or other local issues echo 'facebook sdk returned error: ' . $e->getmessage(); exit; } $me = $response->getgraphuser(); echo 'logged in ' . $me->getname(); ?> </body> </html>
Comments
Post a Comment