window.fbAsyncInit = function() {
FB.init({
appId : '154776817xxxxxxx',
xfbml : true,
version : 'v2.1'
});
};
(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/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
function checkLoginStatus(checkStatus) {
FB.getLoginStatus(function(response) {
if (response.status === 'connected') {
FB.api('/me?fields=id,name,birthday,email,first_name,gender,hometown,last_name,location,middle_name,picture', function(response) {
console.log('Successful login for: ' + response.name);
});
} else {
FB.login( function(){
FB.api('/me?fields=id,name,birthday,email,first_name,gender,hometown,last_name,location,middle_name,picture', function(response) {
console.log('Successful login for: ' + response.name);
});
},{scope: 'email,user_birthday'});
}
});
}
Facebook API Response :
{ "error" : { "message" : "An active access token must be used to query information about the current user.", "type" : "OAuthException", "code" : NumberLong(2500), "fbtrace_id" : "D3axJ2QxG1h" }, "image" : "" }