Unable to renew the token automatically when use Firestore #460
-
Working on a long-running service and send heartbeats every 60 seconds by creating a Firestore document.
Digged some old discussions but none of those workarounds are working. I tried to force a refresh by
With no luck. Any clue? Setup:
|
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 2 replies
-
Arrgh, yes. I think I followed the example correctly, am I ?
Unfortunately I don't have JTAG on hand so I can't set some breakpoints for further debugging ... BTW, it's my great honor to nominated you for the award and glad you earned it! |
Beta Was this translation helpful? Give feedback.
-
That is a bug also found in this issue #461. I have updated the library to fix this bug, please update the library. Thanks for addressing the issue. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the prompt reply and I did updated the library to 4.3.2 (clean install, of course) |
Beta Was this translation helpful? Give feedback.
-
The token will be refresh in 55 minutes by default. The You should make sure that no other codes that block the If your device time was synched with NTP server or manually set after To test
Edit: seconds count instead of milliseconds count |
Beta Was this translation helpful? Give feedback.
-
Thanks. I do review your commit in #461 and add -DESP32 in build_flags of platformio.ini just out of curiosity. Now it seems triggering token refresh and expiration does not happend now.
The token had refreshed five minutes before the expiry (1 hour, 16:23 local time) mark, seems working as intended. That's weirdo but so far so good. |
Beta Was this translation helpful? Give feedback.
The token will be refresh in 55 minutes by default. The
Firebase.ready()
should be executed in time i.e., within 55 minutes since token generated.You should make sure that no other codes that block the
Firebase.ready()
from execution.If your device time was synched with NTP server or manually set after
Firebase.begin
, you should callFirebase.begin
again to reset the authentication. This is because thetime(nullptr)
will return the seconds count instead of timestamp when your device time was not synched or set. Then token expiry time is based on the seconds count instead of timestamp in this case.To test
Firebase,ready
function to work, you can place this option in setup or anywhere to…