Javascript 初次登录后js api没有扩展权限

Javascript 初次登录后js api没有扩展权限,javascript,api,permissions,facebook-login,Javascript,Api,Permissions,Facebook Login,我正在尝试在我的应用程序中设置请求用户电子邮件的权限 <script> window.fbAsyncInit = function() { FB.init({ appId : 'APP_ID', status : true, cookie : true, xfbml : true, oauth : true, }); FB.Event.subscribe('auth.login', f

我正在尝试在我的应用程序中设置请求用户电子邮件的权限

<script>
window.fbAsyncInit = function() {
  FB.init({
    appId      : 'APP_ID',
    status     : true, 
    cookie     : true,
    xfbml      : true,
    oauth      : true,
  });
  FB.Event.subscribe('auth.login', function(response) {
    //window.location.reload();
    window.location = "/welcome.html";
  });

};


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

<div id="fb-root"></div>
<div class="fb-login-button" data-scope="email" >
    Login with Facebook
</div>

我知道这是可能的,因为我已经看到其他几个应用程序能正确地做到这一点,我只是看不到我遗漏了什么。我也尝试过xfbml方法,但遇到了与div相同的问题。

订阅auth.login事件时要小心。当SDK在FB.init中看到status:true时执行登录检查时,甚至会调用它

请注意我在这里对它所做的操作:它被注释掉了,但是您需要删除并取消注释它,然后运行脚本。您可以看到您希望关注发送给该服务器的状态

FB.Event.subscribe('auth.login', function(response) {
    // {
    //   status: "",         /* Current status of the session */
    //   authResponse: {          /* Information about the current session */
    //      userID: ""          /* String representing the current user's ID */
    //      signedRequest: "",  /* String with the current signedRequest */
    //      expiresIn: "",      /* UNIX time when the session expires */
    //      accessToken: "",    /* Access token of the user */
    //   }
    // }

    alert('event status: ' + response.status);
});

谢谢你的意见,我想给这只猫剥皮的方法不止一种:是的,有很多种。坚持使用一种方法,并对其进行调试。这是最好的攻击计划。好吧,奇怪的是,我今天早上再次测试了这段代码,它按照预期工作,没有任何更改。我不知道发生了什么事。我从fb注销,然后通过我的应用程序登录,然后批准了我的应用程序,并且它显示了电子邮件权限。我猜是哪里有小精灵。
FB.Event.subscribe('auth.login', function(response) {
    // {
    //   status: "",         /* Current status of the session */
    //   authResponse: {          /* Information about the current session */
    //      userID: ""          /* String representing the current user's ID */
    //      signedRequest: "",  /* String with the current signedRequest */
    //      expiresIn: "",      /* UNIX time when the session expires */
    //      accessToken: "",    /* Access token of the user */
    //   }
    // }

    alert('event status: ' + response.status);
});