optional setting in angularfire authwithpassword

193 Views Asked by At

I am using AngularFire $authWithPassword(credentials[, options]) for login. I assume [options] is "remember" with value of default, sessionOnly, none, as described here.

I tried all 3, I can not see any difference in my mobile app. I logged in my app, then kill/close my app, restart it. All 3 options let my app persist/remember username and password and logged in. Should at least None forget authentication data?

This is the code I use for authentication:

var _remember="default"; 
if (!$scope.isAutoLogin){ _
    remember="none";
    //"sessionOnly"; 
};
auth.$authWithPassword({ email: user.email, password: user.password, remember:_remember })
.then(function (authData) { 
    console.log("Logged in as:" + authData.uid); 
}).catch(function (error) {
1

There are 1 best solutions below

0
On

If I see it correctly it is just a matter of syntax, your login should be like this:

auth.$authWithPassword({
  email    : user.email,
  password : user.password
}, {
  remember: "sessionOnly"
});