7

I have a web app that adds an application to a users profile, and requests extended permissions.

I can't seem to find if there is a way to use a script to remove the application from the users profile when they request to do so from my web app. I know they can remove the app when logged into Facebook, but I want to know if I can remove the app with an API call. Thanks for any help.

Kara
  • 6,115
  • 16
  • 50
  • 57
Thom Allen
  • 105
  • 1
  • 1
  • 7

5 Answers5

16

You can use a HTTP DELETE request with:

From http://developers.facebook.com/docs/reference/api/user/#permissions:

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.

Agha Zair Ali
  • 161
  • 1
  • 3
11

The accepted answer is over 3 years old and is now outdated.

From: https://developers.facebook.com/docs/graph-api/reference/user/permissions/#Deleting

You can revoke a specific permission by making a call to a Graph API endpoint:

DELETE /{user-id}/permissions/{permission-name}

This request must be made with a user access token or an app access token for the current app. If the request is successful, you will receive a response of true.

Note that excluding {permission-name} will revoke all permissions.

Community
  • 1
  • 1
Rush
  • 873
  • 11
  • 13
3

This is the javascript way (Fb js sdk api call) to remove the application from the user profile: https://stackoverflow.com/a/7741978/246435

Community
  • 1
  • 1
Qlimax
  • 5,241
  • 4
  • 28
  • 31
1

UPDATED: As others have mentioned, Facebook now has this API. I don't think there is a way to change the accepted answer to give credit unfortunately.

From: https://developers.facebook.com/docs/graph-api/reference/user/permissions/#Deleting

You can revoke a specific permission by making a call to a Graph API endpoint:

DELETE /{user-id}/permissions/{permission-name}

This request must be made with a user access token or an app access token for the current app. If the request is successful, you will receive a response of true.

Note that excluding {permission-name} will revoke all permissions.

Nate Totten
  • 8,904
  • 1
  • 35
  • 41
0

I have a PHP example if anyone is interested (with Graph v5 in 2017):

# v5 with default access token fallback
$fb = new Facebook\Facebook([/* . . . */]);

$fb->setDefaultAccessToken('{access-token}');

# These will fall back to the default access token
$response = $fb->get('/me');
$response = $fb->post('/me/feed', $data);
$response = $fb->delete('/123', $data);

So you would have to use:

$response = $fb->delete('/123', $data);

Instead of using the FacebookRequest class in v4.

AlexioVay
  • 4,338
  • 2
  • 31
  • 49