Facebook JavaScript SDK:无法请求访问电子邮件

Facebook JavaScript SDK:无法请求访问电子邮件,facebook,scope,facebook-javascript-sdk,Facebook,Scope,Facebook Javascript Sdk,我目前正在学习使用Facebook Javascript SDK登录用户。起初我不需要要求电子邮件地址,但现在我需要了。我试过从别人那里读到一些东西,但都不管用。我以前使用的代码可能有问题吗?添加范围的最佳方式是什么:电子邮件 这是我到目前为止使用的代码: <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>A Facebook

我目前正在学习使用Facebook Javascript SDK登录用户。起初我不需要要求电子邮件地址,但现在我需要了。我试过从别人那里读到一些东西,但都不管用。我以前使用的代码可能有问题吗?添加范围的最佳方式是什么:电子邮件

这是我到目前为止使用的代码:

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8" />
    <title>A Facebook login test!</title>
    <link href='http://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'>
    <style type="text/css">
        h1 {font-family: 'Roboto', sans-serif;}
    </style>
</head>

<body>
    <div id="fb-root"></div>
    <script>
      window.fbAsyncInit = function() {
        // init the FB JS SDK
        FB.init({
          appId      : '{{ FACEBOOK_APP_ID }}',                 // App ID from the app dashboard
          channelUrl : '{{ DOMAIN }}/channel.html',                 // Channel file for x-domain comms
          status     : true,                                    // Check Facebook Login status
            cookie    : true,                                               // enable cookies to allow the server to access the session       
          xfbml      : true                                     // Look for social plugins on the page
        });

      // Here we subscribe to the auth.authResponseChange JavaScript event. This event is fired
      // for any authentication related change, such as login, logout or session refresh. This means that
      // whenever someone who was previously logged out tries to log in again, the correct case below 
      // will be handled. 
      FB.Event.subscribe('auth.authResponseChange', function(response) {
      // Here we specify what we do with the response anytime this event occurs. 
        if (response.status === 'connected') {
                  // The response object is returned with a status field that lets the app know the current
                  // login status of the person. In this case, we're handling the situation where they 
                  // have logged in to the app.

          window.location = "/fblogin";
            } 
        });
      };

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


    </script>

    <h1>This is the Facebook and Google+ login test.</h1>
    <br>
    <fb:login-button show-faces="true" width="200" max-rows="1" scope: "email"></fb:login-button>
    <br>
为什么用户没有被要求让我的应用程序访问他的电子邮件地址

提前感谢,, 大卫。

你写道:

试试这个: