基本登录不使用ionic.io平台

时间:2016-07-19 06:09:34

标签: ionic-framework

我正在使用Ionic Platform的Auth服务来注册和登录用户。注册工作正常,但在登录时,它既不调用成功函数也不调用错误函数。但是,控制台会显示消息“离线用户:加载的用户"。

Ionic.Auth.login('basic', {'remember': true}, details).then(
    function(loggeduser){
        console.log("logged in");
        $ionicLoading.hide();
        $state.go('app.dashboard');
    }, function(error){
        $ionicLoading.hide();
        vm.showAlert('Invalid username or password.');
    }
);

1 个答案:

答案 0 :(得分:0)

注册用户后,请确保(1)您保存了用户,然后(2),在用户成功保存后执行此登录代码。

编辑:

  Ionic.Auth.signup(details).then(function(newUser) {
    user = Ionic.User.current();
    console.log('check here if auth',user.isAuthenticated());
    //Implement your login here
}, function(error) {
    console.log('failed');
});