I am following Firebase Web App with ESP32. After 1 hour I get the token expired message.
From Firebase:”Firebase Authentication sessions are long lived. Every time a user signs in, the user credentials are sent to the Firebase Authentication backend and exchanged for a Firebase ID token (a JWT) and refresh token. Firebase ID tokens are short lived and last for an hour; the refresh token can be used to retrieve new ID tokens.”
Seems like I never get a refresh token.
I have checked my code, checked Firebase console to make sure I’m signed in, Firebase rules are read True and write True, user ID prints in serial monitor.
Hi Sara, I am following data logging portion of the Firebase Web App but replacing readings instead of logging them. Here is the code.
https://pastebin.com/ixzFLQdx
It works well except for the expiring token after an hour.
Regards,
Rob
Hi.
I think you’re missing the line of code that checks that Firebase is ready (that line also refreshes the token if needed).
if (Firebase.ready() && (millis() - sendDataPrevMillis > timerDelay || sendDataPrevMillis == 0)){ sendDataPrevMillis = millis();
Take a look at the following data logging example – take a look at the loop() section
I hope this helps.
Regards.
Sara
Yes you are right. I left that line out as I did not need the timer not realizing that function was in there.
Thanks! , Rob