I have an ionic and angularjs app with two pages. The first one is a login page, and the second one is a loginSucess page. In the login page i put a button that runs the code below on the ng-click:
This function runs a facebook login routine.
// Function code
var ref = new Firebase("https://pet-wise.firebaseio.com/users");
ref.authWithOAuthPopup("facebook", function(error, authData) {
if (error) {
console.log("Login Failed!", error);
} else {
Apperyio.navigateTo("loginSucess", {});
console.log("Authenticated successfully with payload:", authData);
}
});
When I click on the facebook login button for the first time, the app performs the function and returns the authData object sucessfully, but the app remains on the login page. On the console I can see the authData object. The expected behavior would be that the app was directed to the loginSucess page.
Just when I click the button for the second time the app redirects to the loginSucess page.
What am I doing wrong?