简体   繁体   English

我可以从Facebook iOS SDK撤消public_profile权限吗?

[英]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. 因此,故事是,当用户使用其Facebook帐户登录我的应用程序时,我正在使用他的Facebook登录信息在数据库中创建一个帐户。

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. 现在,当用户从我的应用程序(和最终从数据库中)删除其帐户时,他的帐户仍列在使用Facebook登录名安装了我的应用程序的用户的Facebook列表中。 So I want user's account deleted from facebook as well, when he deletes account from my database. 因此,当用户从我的数据库中删除帐户时,我也希望从Facebook上删除该用户的帐户。 to solve this problem i searched and found that i can make user revoke permissions from facebook iOS sdk. 为了解决此问题,我进行了搜索,发现我可以使用户撤消来自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. public_profile的权限访问不会被撤消。

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. 如果不是,那我应该如何解决我从Facebook列表中删除帐户的基本问题。

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. 从本质上讲,只要FBSDK图可以让您走,只需将对我有用的@“ me / permissions / public_profile”替换为@“ me / permissions”。

[[[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?: 另外,是否尝试查看在其网站上使用FB graph API时调用此删除的效果?:

https://developers.facebook.com/docs/facebook-login/permissions/v2.4 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: 您还可以通过调用此Graph API端点,让人们完全取消对应用程序的授权或撤消登录:

DELETE /{user-id}/permissions 删除/ {user-id} /权限

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. 如果请求成功,您的应用将收到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. 由于您正在取消对应用程序的授权,因此他们也必须像首次登录一样授予对您应用程序的访问权限。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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