2016-02-17 3 views
-1

Я использую этот простой FB подключенияfacebook подключения не возвращает адрес электронной почты

<a href="#" onclick="fb_login();">Connect</a> 

window.fbAsyncInit = функция() { FB.init ({ APPID: 'YOUR_APP_ID', OAuth: правда, status: true, // проверить статус входа cookie: true, // включить файлы cookie, чтобы сервер мог получить доступ к сеансу xfbml: true // parse XFBML });

};

function fb_login(){ 
    FB.login(function(response) { 

     if (response.authResponse) { 
      console.log('Welcome! Fetching your information.... '); 
      console.log(response); // dump complete info 
      access_token = response.authResponse.accessToken; //get access token 
      user_id = response.authResponse.userID; //get FB UID 

      FB.api('/me', function(response) { 
       user_email = response.email; //get user email 
       console.log(response); 

      }); 

     } else { 
      //user hit cancel button 
      console.log('User cancelled login or did not fully authorize.');  
     } 
    }, { 
     scope: 'email' 
    }); 
} 
(function() { 
    var e = document.createElement('script'); 
    e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js'; 
    e.async = true; 
    document.getElementById('fb-root').appendChild(e); 
}()); 

При подключении, он возвращает только мне

Object {имя: "мое имя здесь", идентификатор: "102xxxxxxxx230"}

Как я могу получить адрес электронной почты?

ответ

Смежные вопросы