javascript Facebook api权限范围问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23626321/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 01:14:19  来源:igfitidea点击:

Facebook api permissions scope issue

javascriptfacebookpermissions

提问by hahaha

I have this log in script

我有这个登录脚本

$('#getFbImg').click(function () {
        FB.getLoginStatus(function(response) {
            if (response.status === 'connected') {
                var uid = response.authResponse.userID;
                var accessToken = response.authResponse.accessToken;
                getPermissions(uid);
                getUserAlbums(uid);
                getUserUploads(uid);
            } 
            else if (response.status === 'not_authorized') {
                // the user is logged in to Facebook, 
                // but has not authenticated your app
            } 
            else {
                // the user isn't logged in to Facebook.
                FB.login(function(response) {
                    if (response.authResponse) {
                        var uid = response.authResponse.userID;
                        var accessToken = response.authResponse.accessToken;
                        getPermissions(uid);
                        getUserAlbums(uid);
                        getUserUploads(uid);
                    } else {
                        console.log('User cancelled login or did not fully authorize.');
                    }
                }, {scope: 'public_profile,user_photos'});
            }
        });
    });

which asks the user to log in in order to continue. The popup window works fine, logs in fine, but the permissions dont seem to be registered. The very weird partis that for my account (which is also the admin in the app) was asked for the permissions, but every other account is not. here is a picture with the permissions object enter image description here

它要求用户登录以继续。弹出窗口工作正常,登录正常,但权限似乎未注册。在很怪异的一部分是,我的帐户(这也是在应用程序管理)的要求的权限,但其它帐户不是。这是一张带有权限对象的图片 在此处输入图片说明

edit:if I add another permission to the scope eg user birthday, my account gets asked to accept the access of the new permission, but no other account is asked for this.

编辑:如果我向范围添加另一个权限,例如用户生日,我的帐户会被要求接受新权限的访问,但没有其他帐户被要求这样做。

2nd edit:i added a few other administrator accounts to check if it is because i am the administrator, and i still get the permission problem, the application does not give access to their user_photos, but it still gives to my account

第二次编辑:我添加了一些其他管理员帐户来检查是否因为我是管理员,但我仍然遇到权限问题,该应用程序没有授予他们的 user_photos 访问权限,但它仍然授予我的帐户

回答by Tobi

I guess you're using the Graph API v2.0, and haven't yet had your user_likesand user_photospermissions approved for your app: https://developers.facebook.com/docs/apps/changelog#v2_0_permissions

我猜你正在使用的图形API 2.0版,但尚未有你user_likes,并user_photos批准了您的应用程序的权限:https://developers.facebook.com/docs/apps/changelog#v2_0_permissions

Apps using Facebook Login that require more than public_profile (default), email and user_friends will require review by Facebook in order to request these permissions from people.

使用 Facebook 登录且需要更多 public_profile(默认)、电子邮件和 user_friends 的应用程序将需要 Facebook 审核才能向人们请求这些权限。

Have a look at https://developers.facebook.com/docs/apps/reviewfor the Review process.

查看https://developers.facebook.com/docs/apps/review以了解审核流程。