# Auth Persistence in browser using Ionic4 and Firebase

**URL:** <https://forum.ionicframework.com/t/auth-persistence-in-browser-using-ionic4-and-firebase/170497>\
**Category:** ionic-v3\
**Created:** [August 5, 2019, 4:49pm UTC](https://forum.ionicframework.com/t/auth-persistence-in-browser-using-ionic4-and-firebase/170497 "2019-08-05T16:49:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![adsfelipe](https://avatars.discourse-cdn.com/v4/letter/a/91b2a8/32.png) [@adsfelipe](https://forum.ionicframework.com/u/adsfelipe)\
**Post date:** [August 5, 2019, 4:49pm UTC](https://forum.ionicframework.com/t/auth-persistence-in-browser-using-ionic4-and-firebase/170497/1 "2019-08-05T16:49:27Z")

</div>

I’m trying to set persistence authentication to my ionic 4 web project.

I’ tried firebase and angularfire2 methods and my local storage is enabled.

```auto
firebase.auth().setPersistence(firebase.auth.Auth.Persistence.LOCAL);

angularFireAuth.authState.subscribe((user)=>{
  console.log(user);      
});

firebase.auth().onAuthStateChanged((user) => {
  if (user) {
    console.log(user);        
  } else {
    console.log("nop");        
  }
});

```

Both methods return NULL when the page is refreshed, and then the user is redirected to the login page. I would like to implement a way the user stays logged in.

tested in chrome.
