Ionic: Authentication not persistent when merging to firebase v3 -
i'm merging ionic app firebase v2 firebase v3.
when use new (v3) firebase email/password login api, not authenticated have log in every time app re-started.
the user should stay authenticated when first logged in app. or @ least default in firebase v2 api.
how can persist login?
thanks, jørgen
you should use onauthstatechanged(). function called time there's change in authentication state.
firebase.auth().onauthstatechanged(function(user) { if (user) { // user signed in. ... other stuff } else { // no user signed in. ... other stuff } }); if logged in when open app, or call signinwithemailandpassword, function called , user contain firebase.auth().currentuser.
Comments
Post a Comment