简体   繁体   English

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

[英]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 登录后我需要他进入视图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'); 我用了$state.go('tabs.home'); but I had to put it in the app.factory rather than in the controller. 但我必须将其放在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);
    }
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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