How can I allow a user to revoke access to my application using their API service, SDK. http://developers.facebook.com/docs/sdks/
Looking at the documentation I can\
For anyone who would find this helpful, I was losing sleep and wrecking my brain for days trying to get this to work;
FB.api('/me/permissions', 'DELETE', function(response) {
if (response == true) {
window.top.location = 'logout-facebook.php';
} else {
alert('Error revoking app');
}
});
I finally got this to work when I observed that the "response" being returned was not a boolean but a JSON object.
The JSON object being returned was either;
{
success: "true"
}
OR
{
success: "false"
}
Following that, the correct code was;
FB.api('/me/permissions', 'DELETE', function(response) {
if (response.success == true) {
window.top.location = 'logout-facebook.php';
} else {
alert('Error revoking app');
}
});
Hope this helps someone!
For the FB JavaScript SDK:
FB.api('/me/permissions', 'delete', function(response) {
console.log(response); // true
});
With PHP SDK V 5
$DeletePermsUser = $fb->delete('/{user-id}/permissions/',[],$access_token);
in the graph API for the user object you can issue an HTTP DELETE request to /PROFILE_ID/permissions to revoke authorization for an app.
from the official documentation (developers.facebook.com/docs/reference/api/user/):
You can de-authorize an application or revoke a specific extended permissions on behalf of a user by issuing an HTTP DELETE request to PROFILE_ID/permissions with a user access_token for that app.
Parameter Description Type Required permission The permission you wish to revoke. If you don't specify a permission then this will de-authorize the application completely. string no You get the following result.
Description Type True if the delete succeeded and error otherwise. boolean