1

我创建了一个具有以下权限的 facebook 应用程序: emailuser_birthday user_education_history user_hometownuser_likes friends_birthday friends_education_history friends_hometown friends_likes

当我单击预览登录对话框时,我看到:所有权限

但是当我通过我的 Javascript 代码访问应用程序时,

<html>
<body>
<div id="fb-root"></div>
<script>
 // Additional JS functions here

window.fbAsyncInit = function() {
FB.init({
  appId      : '483353595041064', // App ID
  channelUrl : 'channel.html', // Channel File
  status     : true, // check login status
  cookie     : true, // enable cookies to allow the server to access the session
  xfbml      : true  // parse XFBML
 });

// Additional init code here
FB.getLoginStatus(function(response) {
  if (response.status === 'connected') {
    alert("Welcome");
  } else if (response.status === 'not_authorized') {
    login();
  } else {
    // not_logged_in
  }
 });


 };

 function login() {
FB.login(function(response) {
    if (response.authResponse) {
        // connected
        testAPI();
    } else {
        // cancelled
    }
});
}

 function testAPI() {
  console.log('Welcome!  Fetching your information.... ');
  FB.api('/me', function(response) {
    console.log('Good to see you, ' + response.name + '.');
  });
 }
// Load the SDK Asynchronously
 (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));
</script>
</body>
</html>

我只能在获得许可的情况下看到基本信息:

为什么预览框中的权限不反映在实际登录框中?

4

1 回答 1

1

这是因为您在登录时没有设置权限(在您的代码中)。试试这个-

FB.login(function(response) {
  if (response.authResponse) {
      // connected
      testAPI();
  } else {
      // cancelled
  }
},{scope:'email, etc...'});
于 2013-01-10T10:22:28.393 回答