简体   繁体   中英

Can i revoke public_profile permission from facebook iOS sdk?

in my app i ran into some problems. i hope someone could help me out with this. so the story is, when a user logs into my app with his facebook account i am creating an account on my database with his facebook login information.

Now when user deletes his account from my app(and database eventually) his account is still listed in facebook's list of the users who have installed my app using facebook login. So I want user's account deleted from facebook as well, when he deletes account from my database. to solve this problem i searched and found that i can make user revoke permissions from facebook iOS sdk. I don't know if this is gonna solved my problem or not, but i thought i would give it a try.

now when i am revoking users access of permission with the following code:-

        [[[FBSDKGraphRequest alloc] initWithGraphPath:@"me/permissions/public_profile"
                                           parameters:nil
                                           HTTPMethod:@"DELETE"]
         startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
             NSLog(@"DELETE-public_profile == %@",result);
         }];
        [[[FBSDKGraphRequest alloc] initWithGraphPath:@"me/permissions/email"
                                           parameters:nil
                                           HTTPMethod:@"DELETE"]
         startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
             NSLog(@"DELETE-Email == %@",result);
         }];

Permission access for public_profile is not getting revoked.

Is it even possible to delete this permission ?

if not , than how should i attempt to solve my basic problem of deleting account from facebook list.

This as far as the FBSDK graph will let you go, essentially, just replace the @"me/permissions/public_profile" with @"me/permissions" it works for me.

[[[FBSDKGraphRequest alloc] initWithGraphPath:@"me/permissions" parameters:nil 
    HTTPMethod:@"DELETE"] startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
  // ...
}];

This will delete all permissions and should revoke access completely as well as detach the user from the app

Also, have tried to see the effect of calling to this delete while using FB graph API on their website?:

https://developers.facebook.com/docs/facebook-login/permissions/v2.4

that is:

Revoking Login

You can also let people completely de-authorize an app, or revoke login, by making a call to this Graph API endpoint:

DELETE /{user-id}/permissions

This request must be made with a valid user access token or an app access token for the current app. If the request is successful, your app receives a response of true. If the call is successful, any user access token for the person will be invalidated and they will have to log in again. Because you're de-authorizing your app, they will also have to grant access to your app as if they were logging in for the first time.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM