Problem with social login [Facebook]

I am building a Cordova app using ionic platform. I am using the script submitted on this thread:
http://support.backendless.com/t/error-in-facebook-login
here is my code:
HTML:

<div class="row">
<div class="col text-center">
<button id="fb_login" ng-click="fbLogin()">{{labels.FB_LOGIN}}</button>
</div>
</div>

Controller:

angular.module('starter')
.controller('SettingsCtrl',function ($scope,$LABELS) {
$scope.labels = $LABELS;
$scope.fbLogin = function () {
window.fbAsyncInit = function() {
FB.init({
appId: '000000000',
xfbml: true,
version: 'v2.5'
});
FB.getLoginStatus(function(response) {
console.log(response);
});
Backendless.initApp("######", "######", "v1");
var successCallback = function(response) {
console.log(response);
};
var errorCallback = function(response) {
console.log(response);
};
var BEmap = {
'first_name': 'name',
'email': 'email',
'picture': 'image',
'address': 'address',
'about': 'description',
'city': 'city'
};
Backendless.UserService.loginWithFacebookSdk(BEmap, new Backendless.Async(successCallback, errorCallback));
};
(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'));
}
});

Using the original code in the thread mentioned above works fine in both registration as well as login. Although I replicated the same code exactly in my code as shown above, it does not work in login or registration. Although the oAuth dance looks to work properly since the authorization is created in the facebook user profile.
One more thing, the code used in thread is not generating the user record properly in the users collections. It maps the userid into the email although the Facebook user email is set!
I am attaching the errors spitted into chrome console
Any ideas?!

Screen Shot 2016-03-01 at 8.00.19 PM.png

Hi Ahmed,

This is outside of my expertise, I assigned it to a developer who will be in touch with you.

Regards,
Mark

Thanks

@Mark

I think I found why the code works in thread (http://support.backendless.com/t/error-in-facebook-login) while not working within my code.

The backendless.js use in the thread is different than that downloaded from the idk page on back endless.com. Unfortunately there is no version information to refer. But this needs to be addressed immediately since it is apparently a bug in the downloaded version.

Are you using the version of backendless.js that you downloaded from our website?

Yes indeed, the code using the SDK downloaded from your website did not work. The version downloaded form he mentioned thread worked perfectly.

Hi Ahmed,

we have fixed this issue and will notify you soon when it appears in new release.

Regards,
Stanislav

Thanks for the update, hope this is released soon. Have you looked into the mapping issue?

Moreover, using logInwithFacebook() method generates the following error:

Refused to display 'https://m.facebook.com/v2.5/dialog/oauth?redirect_uri=https%3A%2F%2Fapi.bac…016&scope=email%2Cpublic_profile%2Cuser_about_me&client_id=#######' in a frame because it set 'X-Frame-Options' to 'DENY'.

Hi, Ahmed!
Concerning your initial LoginWithFacebookSdk issue. As said, we’ll notify you, when the fix is released.
But I’ve noticed, that in your code loginWithFacebookSdk method is not used correctly. You have to invoke loginWithFacebookSdk method after you’ve performed a successful login with Facebook Sdk itself. The code should like this:

FB.login(function(response) {
    if (response.authResponse) {
     console.log('Welcome!  Fetching your information.... ');
        var BEmap = {
        'email': 'email'
        };


        Backendless.UserService.loginWithFacebookSdk(BEmap, new Backendless.Async(callback, gotError));


    } else {
     console.log('User cancelled login or did not fully authorize.');
    }
}, {scope: 'email'});

First, you call FB.login() method to login with Facebook Sdk and if the login is successful - invoke the Backendless.UserService.loginWithFacebookSdk().
Here are some relevant links:

Hi, Ahmed!

We’ve fixed this issue and you can give it a try with the code I wrote in the previous post.

Thanks, it works