I was try to integrate facebook with backendless, and need to get friend list in AngularJs.
While registering web application with facebook using backendless I have given
App Domains : app.backendless.com
Site URL : https://api.backendless.com .It was giving correct response for login ,then if we make an api call to get friend list using javascript sdk it was giving error( The domain of this URL isn’t included in the app’s domCan’t Load URL:ains. To be able to load this).Later I have changed (I was running my application on localhost)
App Domains : localhost
Site URL : http://localhost:8080/Instagram-poc/ .
Now if the user is logged in already the api calls were working, if user not logged in yet then again I got same error( The domain of this URL isn’t included in the app’s domCan’t Load URL:ains. To be able to load this).
This is my code
function callback(user){
console.log(angular.toJson(user));
}
function gotError( err ){
// see more on error handling
console.log( "error message - " + err.message );
console.log( "error code - " + err.statusCode );
}
$scope.login = function(){
facebookFieldsMapping = {email:"email"};
permissions = "email";
Backendless.UserService.loginWithFacebook(facebookFieldsMapping, permissions, new Backendless.Async(callback, gotError));
FB.init({
appId : '240390603000275',
xfbml : true,
version : 'v2.6'
})
FB.getLoginStatus(function(response) {
if (response.status === 'connected') {
FB.api('/me/friends', function(response) {
$scope.$apply(function() {
$scope.myFriends = response.data;
console.log($scope.myFriends);
});
});
} else {
FB.login();
}
});
}
Please, can anybody give me the solution