[FEATURE REQUEST] Change time based token refresh to triggered
Is your feature request related to a problem? Please describe. Didn't tested it, but it could be possible, that the 1h timer for a token refresh will fail. So the next call to the Firebase would also failing unauthenticated. That's why I would get rid of the timer based refreshing.
Describe the solution you'd like The token is a plain JWT, so it contains a exp attribute, which can be checked against. If the time is in a defined time window (1 min, 5 min, 10 min) or later you can use it to refresh the token with the refresh token. But here is the fun part. If the game didn't call the Firebase for hours, you don't need to refresh that token, because the refresh token will work forever.
My idea for a better solution would be to parse the JWT and only call refresh, if a call is made to the firebase eg. 2 min before the exp or later. So you can save bandwith and batterie (on mobile), because the radio didn't need to be activated for your game.
I know this will be a large change in the codebase, but it should be done. Only do external requests if needed and every hour isn't needed, if the game/app isn't calling Firebase.
@mars3142 this would be a pretty big lift, let me check with the team and see what they think.
Thanks
Chuck
This is going to be a bit too much for the time being. It's not a bad idea, and we have some thoughts on how to at least mitigate the problems you point out, but I'm prepping for GodotCon, and everyone else is busy/has lives. :) I'll leave this open for now, just making sure to reply.
Cool, thanks for the reply. I know that this would be a big change, as I wrote it already within my FR.