简体   繁体   中英

Redirect view after login with facebook using Firebase and Ionic

Authentication is functioning normally, but once I login, it continues in the same view.

I need after login he goes to the view dash.html

As I redirect the user after he login?

$scope.loginFacebook = function(){

  var ref = new Firebase("https://<NAME>.firebaseio.com");
  var authObject = $firebaseAuth(ref);

  authObject.$authWithOAuthRedirect("facebook").then(function(authData) {
    console.log(authData);
  }).catch(function(error) {
    console.log('error' + error);
  })
}

I had the same problem. I used $state.go('tabs.home'); but I had to put it in the app.factory rather than in the controller.

auth.$onAuth(function(authData) {
    $state.go('tabs.home');
    if(authData) {
        angular.copy(authData, Auth.user);
        Auth.user.profile = $firebaseObject(....));
    } else {
        if(Auth.user && Auth.user.profile) {
        }
        angular.copy({}, Auth.user);
    }
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM