Facebook连接-需要电子邮件和用户喜欢

Facebook Connect - Need email and userlikes

本文关键字:用户 喜欢 电子邮件 连接 Facebook      更新时间:2023-09-26

我似乎无法获得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想要访问您的公开个人资料和好友列表。

我做错了什么?

当你设置范围时,你并没有给应用程序权限。你只是告诉你的应用程序需要的权限。当你第一次点击登录按钮时,就会出现"MyApp想要访问你的公开个人资料和好友列表"的对话框。你需要通过点击ok按钮或对话框中的类似按钮来确认你授予了应用程序该权限。

你应该不需要再这样做,除非你改变了你的应用程序id或密钥,或者你在facebook设置中手动撤销了该应用程序的授权。