Facebook Connect - 需要电子邮件和用户

时间:2013-06-11 08:42:41

标签: javascript facebook facebook-graph-api

我似乎无法获得我的Facebook连接的权限。这就是我所拥有的:

window.fbAsyncInit = function() {
    FB.init({
        appId      : 'myID', // App ID
        channelUrl : 'myChannel', // Channel File
        status     : true, // check login status
        cookie     : true, // enable cookies to allow the server to access the session
        xfbml      : true,  // parse XFBML
        oauth      : true
    });
    FB.Event.subscribe('auth.authResponseChange', function(response) {
        if (response.status === 'connected') {testAPI();} 
        if (response.status === 'not_authorized') { FB.login(function(response) {}, {scope: 'email,user_likes'});} 
        else { FB.login(function(response) {}, {scope: 'email,user_likes'});}
    });
};

(function(d){
    var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
    if (d.getElementById(id)) {return;}
    js = d.createElement('script'); js.id = id; js.async = true;
    js.src = "//connect.facebook.net/en_US/all.js";
    ref.parentNode.insertBefore(js, ref);
}(document));

当我点击我的登录按钮时,它会问:

  

MyApp希望访问您的公开个人资料和朋友列表。

我做错了什么?

1 个答案:

答案 0 :(得分:1)

设置范围时,您没有授予应用程序权限。您只是告诉您的应用需要的权限。 当您第一次单击登录按钮时,该对话框显示“MyApp想要访问您的公开个人资料和朋友列表”。出现。您需要通过单击该对话框中的“确定”按钮或类似按钮确认您是否已将权限授予您的应用。

除非您更改应用程序ID或密钥,或者在Facebook设置中手动撤销该应用程序的授权,否则您不需要再次访问此内容。

相关问题