idanwe / accounts-password-client-side

Use Meteor's accounts-password package with meteor-client-side.
MIT License
13 stars 10 forks source link

Meteor kills user session randomly #9

Open vishalwayachal opened 7 years ago

vishalwayachal commented 7 years ago

I am using meteor 1.4 for server side and an ionic for client application. We are connecting through meteor client library. we are using following js libraries:

What I have observed that meteor kills user session randomly. Below is sample code and steps to reproduce an issue:

Step 1 : deploy meteor sample site with below code to login/logut

Step 2 : browser the meteor app browser Tab 1 and then login

Step 3 : Now browser the meteor app in another Tab 2 - which shows you logged in

Step 4 : Logout from Tab 2

Step 5 : Again from Tab 2 try to login with different user. In this case Login success but after some seconds it auto logout

for login using following code

 $meteor.loginWithPassword($scope.credentials.username, 
 $scope.credentials.password)
  .then(function() {
    console.log('Login success ');
    //alert("logged in: " + $scope.credentials.username);
    $state.go('home');
  }, function(_error) {
    console.log('Login error - ', _error);
    alert("Error: " + _error.reason);
  });

for logout using following code

$meteor.logout().then(function(_response) {      
  $state.go('login');
});   

On server logs it shows an error:

Please let me know what is causing to kill the session and if you have any solution for same.