Ali
Ali

Reputation: 407

How to send client access token with app secret to Facebook account kit and get the resons

I have developed an Andriod app, and I use Facebook account kit to validate the phone number after I send the phone number to Facebook account kit then Facebook sends an access token to the client, then I send the client access token to my web server and from web server to account kit as bellow:

$access_token = 'xxxxxxxxxxxxxxxxxxxxxxxxx';
$app_secret = 'yyyyyyyyyyyyyyyyyyyyyyy';
$appsecret_proof = hash_hmac('sha256', $access_token, $app_secret);  
$url = 'https://graph.facebook.com/v2.1/me?access_token='.$access_token.'&appsecret_proof='.$appsecret_proof;
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL,$url);
$result=curl_exec($ch);
curl_close($ch);  
$final = json_decode($result);   
echo"<pre>";print_r($final);

But it gives error shown bellow:

stdClass Object
(
   [error]=> stdClass Object
   (
       [message]=>Malformed access token
       [type]=>OAuthException
       [code]=>190
       [fbtrace_id]=>FQftlVOKYL+
   )
)

My app setting in account kit setup as bellow: enter image description here

Any solution, please!

Upvotes: 0

Views: 1719

Answers (1)

Olga Kuznetsova
Olga Kuznetsova

Reputation: 361

You should be calling the Account Kit graph API and not the Facebook one.

https://developers.facebook.com/docs/accountkit/graphapi

Upvotes: 2

Related Questions