With these blocks I managed to get a new id token every 3600 seconds, for firebase authentication.
In my case I need to write data in firebase, but the write permission is only available for authenticated users, so I need to renew the token every time it expires.
I think this is better than being logged in every time the user runs the application.
Modifying this example, we can create new users, log in or even reset the password, we can stop relying on one more extension in our application in my case Firebase Auth v3 that although it helped me to build my project, it stopped being To some extent, Google Play Console sent me an alert of API data exposed in my app, because Firebase Auth v3 does not allow obfuscating the API key.
More examples to use. Firebase Auth REST API | Firebase