简体   繁体   English

Android Facebook 4.0:检查权限

[英]Android Facebook 4.0: Check permissions

Many things been changed in Facebook 4.0. Facebook 4.0中发生了许多变化

How to check if user have permission in Facebook 4.x api? 如何检查用户是否在Facebook 4.x api中具有权限?

Found it : 找到了

People can grant only a subset of permissions that you ask for, except for public profile, which is granted at login. 人们只能授予您要求的权限的子集,但公共配置文件除外,该配置文件是在登录时授予的。

People can also revoke permissions granted to your app in Facebook's interface at any time after they have logged in. So your app should regularly check which permissions have been granted. 人们也可以在登录后随时在Facebook界面中撤消授予您的应用程序的权限。因此,您的应用程序应定期检查已授予了哪些权限。 We provide methods for you to check what permissions are currently granted to your app. 我们提供方法供您检查当前授予您的应用程序哪些权限。

To get the list of permissions associated with the current access token, call: 要获取与当前访问令牌关联的权限列表,请调用:

AccessToken.getCurrentAccessToken().getPermissions()

Note that AccessToken.getCurrentAccessToken() can be null 请注意, AccessToken.getCurrentAccessToken()可以为null

After Successfull Login Call this method 成功登录后,调用此方法

在此处输入图片说明

    new GraphRequest(
        AccessToken.getCurrentAccessToken(),
        "/{user-id}/permissions",
        null,
        HttpMethod.GET,
        new GraphRequest.Callback() {
            public void onCompleted(GraphResponse response) {
                /* handle the result */
            }
        }
    ).executeAsync();

================================================================
 new GraphRequest(
                AccessToken.getCurrentAccessToken(),
                "/744511125731315/permissions",
                null,
                HttpMethod.GET,
                new GraphRequest.Callback() {
                    public void onCompleted(GraphResponse response) {
                        CommonMethod.showAlert("PERMISSION_GRANTED Fb ---> " + response, MainActivity.this);
                    }
                }
        ).executeAsync();
============================================

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

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