javascript - How to prevent Firebase anonymous user token from expiring -
i'm using anonymous authentication firebase app. noticed have on 100 anonymous users registered though i've been doing testing app. looks expiration time user token quite short, , expires next login causes new user created.
what best way avoid this? presumably refresh user's token i'm not sure how since in onauthstatechange
user
parameter null
if user has expired.
or should changed expiration time? if so, how do this? found instructions doing in old firebase docs can't see how in latest version.
update: initializing app , authenticating (anonymous) user so:
firebase.initializeapp(firebase_config); firebase.auth().onauthstatechanged(user => { if (!user) { firebase.auth().signinanonymously().catch(error => { console.error('failed authenticate firebase', error); }); } });
Comments
Post a Comment