Issue with firebase.auth().setPersistence(firebase.auth.Auth.Persistence.LOCAL)

764 views
Skip to first unread message

Mark James Butcher

unread,
Sep 7, 2023, 10:34:59 AM9/7/23
to Firebase Google Group
Building in react native and finding it tricky to have an automatic sign-in flow to the app, that once a user signs in, firebase remembers the user just like the JWT but using persistence. 

If I use the code below, the line
  firebase.auth().setPersistence(firebase.auth.Auth.Persistence.LOCAL);
 gives an error in the terminal when I try sign in.  [TypeError: undefined is not an object (evaluating 'this.storage.setItem')] 

Screenshot 2023-09-07 at 2.31.42 pm.png

I have tried to also place the setPersistance within other areas of the app but it seems I have some issue not understanding how the implementation is done correctly. I have the onAuthStateChanged checking users within the Navigation file.
 
Screenshot 2023-09-07 at 2.36.04 pm.png 
Reply all
Reply to author
Forward
0 new messages