使用Firebase和Ionic登录Facebook后重定向视图

Redirect view after login with facebook using Firebase and Ionic

本文关键字:重定向 视图 Facebook 登录 Firebase Ionic 使用      更新时间:2023-09-26

身份验证运行正常,但是一旦我登录,它就会继续在同一视图中。

我需要在登录后他转到视图dash.html

当我在用户登录后重定向用户时?

$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);
  })
}

我遇到了同样的问题。 我用了$state.go('tabs.home');但我不得不把它放在app.factory而不是控制器中。

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);
    }
});