luiscarlosjayk/angular-facebook

Returned object doesn't contain email

Closed this issue · 1 comments

Tried like this (the post sends the accessToken to my php backend):

Facebook.login(function(response) {
    if (response.status === 'connected') {
        console.log(response); //what is going on, no email?
        var data = {
            'token': response.authResponse.accessToken
        };
        var send = angular.toJson(data);
        $http({
            method: 'post',
            url: '/fb',
            data: send
        }).success(function(phpresponse){
            console.log(phpresponse);
        });
    }
},{scope: 'email', return_scopes: true}); // I have the right permissions

Found the answer by reading the Facebook API 2.4 changelog. You need to specify which fields you want the API to return in the request url so /me becomes /me?fields=email,name,etc.. I sure hope it helps someone. Cheers!