Facebook应用未显示更新的权限

时间:2013-01-10 10:11:30

标签: javascript facebook facebook-graph-api permissions facebook-javascript-sdk

我创建了一个具有以下权限的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>

我只能在许可下看到基本信息:

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

1 个答案:

答案 0 :(得分:1)

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

FB.login(function(response) {
  if (response.authResponse) {
      // connected
      testAPI();
  } else {
      // cancelled
  }
},{scope:'email, etc...'});
相关问题