Reputation: 1100
I am using Firebase in my Android notepad app. I enabled Disk persistence and I am using Email + Password to authenticate users. Everything seems to work fine but I noticed that when the app is offline for a certain amount of time, users have to re-authenticate. Is there a way to automatically re-authenticate users when the auth token expires ?
Upvotes: 3
Views: 2415
Reputation: 598688
Firebase Authentication does not automatically refresh tokens.
If you'd be using one of the OAuth providers, you could probably catch the event when the token is about to expire, refresh it and then call authWithCustomToken
again.
But given that you're using email+password authentication, there is nothing you can do but authenticate the user again (if you decide to hang on to their username/password in the app) or have them authenticate again. Also see: Session management with Firebase?
Upvotes: 3