开发者

revokeApplication Using Facebook's Graph API

I'm in the final stages of converting our site over开发者_StackOverflow社区 to Graph API from the Rest API.

The last piece I'm missing is the old "revokeApplication" call used for when a user chooses to "remove connection" from our site.

Despite my desires to completely remove the Rest API, I thought I might just fire it up for this, but it requires a session key -- something no longer stored in the Graph API.

Anybody have any ideas?


I figured it out. I'll leave it here for those that need to know...

The old rest api (including the revokeApplication api) can still be accessed, now with the new OAuth access_token. Just use this url: https://api.facebook.com/method/METHODNAME

For this particular call, it's a POST:

$ch = curl_init();
curl_setopt($ch, CURLOPT_POSTFIELDS, 'access_token='.$users_access_token);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_URL, 'https://api.facebook.com/method/auth.revokeAuthorization');
$output = curl_exec($ch);
curl_close($ch);

More info here: http://developers.facebook.com/docs/reference/rest/


You can do it with the new graph API :

$facebook = new Facebook(array(
  'appId'  => $fbconfig['appid'],
  'secret' => $fbconfig['secret'],
  'cookie' => true
));

$revoked = $facebook->api("/me/permissions", "DELETE");

$revoked is a boolean.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜