facebook javascript sdk - Can't retrieve Fb user object (email, etc) only Id and Name -
i've been trying retrieve facebook email , whole user object according facebook api guide.
i'm trying code but, returns id , name
(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 = "http://connect.facebook.net/en_us/sdk.js"; fjs.parentnode.insertbefore(js, fjs); }(document, 'script', 'facebook-jssdk')); window.fbasyncinit = function() { fb.init({ appid : 'xxxxx', cookie : true, xfbml : true, version : 'v2.4' }); } function ingresar() { fb.login(function(response){ validarusuario(); }, {scope: 'public_profile, email, user_friends', return_scopes: true}); } function validarusuario() { fb.getloginstatus(function(response) { if(response.status == 'connected') { fb.api('/me', function(response) { console.log(response); }); } else if(response.status == 'not_authorized') { alert('debes autorizar la app!'); } else { alert('debes ingresar tu cuenta de facebook!'); } }); }
i've tried call fb.api('/userid') returns same.
notes: email permission default in fb app settings so, it's configured retrieved, it's included in facebook permissions popup.
hope can me!
Comments
Post a Comment