• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Firebase – token is not ready (revoked or expired)

Q&A Forum › Category: ESP8266 › Firebase – token is not ready (revoked or expired)
0 Vote Up Vote Down
Robert Fisher asked 11 months ago

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.
 

Question Tags: Firebase
7 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 11 months ago

Hi.
What is the exact sketch that is giving you trouble?
Regards,
Sara

0 Vote Up Vote Down
Robert Fisher answered 11 months ago

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

0 Vote Up Vote Down
Sara Santos Staff answered 11 months ago

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

ESP32 Data Logging to Firebase Realtime Database


 
I hope this helps.
Regards.
Sara

0 Vote Up Vote Down
Robert Fisher answered 11 months ago

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

0 Vote Up Vote Down
Sara Santos Staff answered 11 months ago

Great.
So, can I close this issue?
Regards.
Sara

0 Vote Up Vote Down
Robert Fisher answered 11 months ago

Yes close issue. Btw, howdy to you too.
Rob

0 Vote Up Vote Down
Sara Santos Staff answered 11 months ago

Great.
I’ll mark this issue as resolved. If you need further help, you just need to open a new question in our forum.
Regards,
Sara

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] Learn Raspberry Pi Pico/Pico W with MicroPython eBook – Version 1.2 May 26, 2025
  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.