I am trying to login using facebook to my app, and am using firebase for my back-end. I am able to click a button and be redirected to facebook login while on my pc, not using ionic-view on my mobile.
When I am prompted to login to on my desktop, I can see there is an active user through, facebook. However, my controller will not change the view.
So i have two real, problems. Ionic view will not redirect when I hit a button, and on my pc $location.path("/tab/home"); does not seem to be working. Any suggestions?
app.controller("LoginFacebookController", function($scope, $firebaseAuth, $location) {
$scope.loginwithfacebook = function(){
var provider = new firebase.auth.FacebookAuthProvider();
provider.addScope('user_birthday');
provider.addScope('user_location');
provider.addScope('user_relationships');
provider.addScope('user_relationship_details');
firebase.auth().signInWithRedirect(provider);
firebase.auth().getRedirectResult().then(function(result) {
if (result.credential) {
// This gives you a Facebook Access Token. You can use it to access the Facebook API.
var token = result.credential.accessToken;
// ...
}
// The signed-in user info.
var user = result.user;
$location.path("/tab/home");
}).catch(function(error) {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
// The email of the user's account used.
var email = error.email;
// The firebase.auth.AuthCredential type that was used.
var credential = error.credential;
$location.path("/tab/home");
// ...
});
}
});