I am working on login with facebook and I need to check if facebook id and email id exists or not. Here is my code
$cordovaOauth.facebook("MY_APP_ID", ["email", "read_stream", "user_website", "user_location", "user_relationships"]).then(function (result) {
$http.get("https://graph.facebook.com/v2.2/me", {params: {access_token: result.access_token, fields: "id,email,first_name,last_name,name,gender,location,website,picture,relationship_status", format: "json"}}).then(function (result) {
localStorageService.set('id', result.data.id);
localStorageService.set('email', result.data.email);
localStorageService.set('fname', result.data.first_name);
localStorageService.set('lastname', result.data.last_name);
localStorageService.set('gender', result.data.gender);
//$scope.auth(); //not working
}, function (error) {
alert("There was a problem getting your profile. Please try again.");
});
$scope.auth();// called with facebook graph api
}, function (error) {
alert("There was a problem signing in! See the console for logs");
});
}
My problem is when I call $scope.auth (http request) inside facebook graph api http request, it does't get called and when I use it outside it called with the facebook graph api (I want to call it after graph api http request). See above code