简体   繁体   English

CocoonJS和Facebook扩展权限

[英]CocoonJS and Facebook extended permissions

First of all, I'm aware there are plenty of questions and answers relating this topic. 首先,我知道有很多与此主题相关的问题和答案。 However, none of them works for me (maybe because they are old and the methods have become outdated, I don't know)... Let me briefly explain my problem: 但是,它们都不对我有用(也许是因为它们陈旧并且方法已经过时,我不知道)...让我简要解释一下我的问题:

I've been trying to login to Facebook with extended permissions on CocoonJS for about two weeks and I'm completely unable to do it... I can successfully login with basic permissions and everything works as expected, but I can't figure out how to request for extended permissions... When calling the Cocoon's FB login with the optional params, only the basic permissions are requested, so actually it seems that Cocoon (or FB) ignores the extended requests : 我一直在尝试使用CocoonJS上的扩展权限登录Facebook大约两周,但我完全无法做到这一点...我可以使用基本权限成功登录,并且一切正常,但我不知道如何请求扩展权限...当使用可选参数调用Cocoon的FB登录时,仅请求基本权限,因此实际上, Cocoon(或FB)似乎忽略了扩展请求

var socialService = CocoonJS.Social.Facebook.getSocialInterface();

socialService.login(function(loggedIn, error) {
    if (error) {
        console.error("login error: " + error.message);
    }else if (loggedIn){
    console.log("login suceeded");

    CocoonJS.Social.Facebook.getLoginStatus(function(response) {
    if (response.status === 'connected')
        CocoonJS.Social.Facebook.api("/me/permissions",
            function (response) {
                if (response && !response.error) {
                    console.log("Granted perms.: "+JSON.stringify(response));
                }else{
                    console.log("ERROR: unable to retrieve permissions");
                }
            }
        );
    }
    });
}, { 'scope': 'user_photos,publish_actions',return_scopes: true });

The thing is, the login function seems to work properly and the "login succeeded" log is printed, and so is the "Granted perms." 事实是,登录功能似乎正常运行,并且打印了“成功登录”日志,“准许的权限”也是如此。 log. 登录。 However, it only shows the basic permissions, completely ignoring the 'user_photos' and the 'publish_actions' ones (they don't even appear in the retrieved list... 但是,它仅显示基本权限,完全忽略了“ user_photos”和“ publish_actions”(它们甚至没有出现在检索到的列表中...

I tried calling the option with 'scope' , with scope , with 'perms' ... but nothing changes the result. 我尝试用'scope'scope'perms'调用该选项...但是没有改变结果。 I've asked in the CocoonJS forums, I've been googling for two weeks, tried different solutions, different Facebook accounts, even tried hardcoding the extended params in the CocoonJS's FB login function (which result in crash), but nothing works... 我在CocoonJS论坛中问过,我已经搜索了两个星期,尝试使用不同的解决方案,使用不同的Facebook帐户,甚至尝试在CocoonJS的FB登录功能中对扩展的参数进行硬编码(这会导致崩溃),但是没有任何效果。 。

Anyone knows how to achieve it? 有人知道如何实现吗?

Thanks in advance for your time and effort! 在此先感谢您的时间和精力!

CocoonJS parses the 'scope' parameter as a string with comma separated values. CocoonJS将“ scope”参数解析为带有逗号分隔值的字符串。 But these permission values are used with a readonly session login. 但是,这些权限值与只读会话登录名一起使用。 Facebook has deprecated logging in with the "publish_actions" permission and suggests that an app should request the bare minimum of read permissions during login and then request any additional or publish permissions when a person actually needs them. Facebook已弃用“ publish_actions”权限登录,并建议应用程序在登录期间应要求最少的读取权限,然后在某人实际需要时再请求任何其他权限或发布权限。

I recommend that you request extended permissions this way: 我建议您通过以下方式请求扩展权限:

CocoonJS.Social.Facebook.requestAdditionalPermissions("publish", "publish_actions", function(response) {
  callback(response.error ? false : true);
});

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

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