Firebase Auth and localStorage

2,096 views
Skip to first unread message

Francisco Mateo

unread,
May 19, 2017, 5:39:31 PM5/19/17
to Firebase Google Group
I noticed while configuring my Vue app with Firebase that upon successful authentication, Firebase will set the user in localStorage.
The documentation does not mention this nor does the API reference.

I wanted to view the source of the auth module for more information...but it's minified: https://github.com/firebase/firebase-js-sdk/blob/master/src/auth.build.js

So, why is this done? 

Bassam

unread,
May 20, 2017, 1:02:26 AM5/20/17
to Firebase Google Group
Hey Francisco, Auth state is saved in localStorage on majority of browsers, though it is saved in indexedDB for IE11 and Edge due to some issue with localStorage synchronization in those browsers.
This could change in the future.  
We have plans to open source the Auth library but it will come later this year.
Is there a specific question you have on this?

Best regards,
Bassam

Christian Martin

unread,
Aug 28, 2017, 7:49:44 PM8/28/17
to Firebase Google Group
Any update on this one? I'm using cordova which stores the anonymous auth credentials inside localstorage. The problem is that IOS wipes out the localstorage when the device is low on space.

Kato Richardson

unread,
Aug 30, 2017, 11:59:54 AM8/30/17
to Firebase Google Group
Hi Christian,

Anonymous auth is not really intended as a permanent auth method. It is, by definition, anonymous.

To make this permanent, there are a couple options:
  1. The common approach: Offer the user an option such as "Want to make sure your data is never lost? Register now." and promote them to a phone, OAuth, or email/password account
  2. Utilize a unique identifier you provide (some sort of device id or registration id) and sign your own tokens
☼, Kato

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-talk+unsubscribe@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/165e5ad8-84b2-43b0-bc43-78e4b4804995%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--

Kato Richardson | Developer Programs Eng | kato...@google.com | 775-235-8398

Reply all
Reply to author
Forward
0 new messages