0

I am working on an ESP8266-based IoT project (waste segregation system) and trying to send data to Firebase Realtime Database. I am using the latest Firebase ESP8266 Client library (FirebaseESP8266.h) on Arduino IDE.

I have configured my Firebase database to public/test mode, meaning it does not require authentication, and I want to write simple integer values to it. My ESP8266 is successfully connecting to Wi-Fi, but writing to Firebase fails.

Hardware:

  • ESP8266 (NodeMCU or generic ESP-12E)
  • Wi-Fi network (SSID provided, password optional)

Firebase setup:

  • Realtime Database: public access enabled (test mode)
  • No auth key required since public mode )

What I have tried:

#include <ESP8266WiFi.h>
#include <FirebaseESP8266.h>
const char* ssid = "mySSID";
const char* password = "";
#define FIREBASE_HOST "myURL"
FirebaseData fbData;
FirebaseConfig fbConfig;
void setup() {
 Serial.begin(115200);
 delay(2000);
 WiFi.begin(ssid, password);
 Serial.print("Connecting");
 while (WiFi.status() != WL_CONNECTED) {
 delay(500);
 Serial.print(".");
 }
 Serial.println();
 Serial.println("✅ Wi-Fi Connected");
 fbConfig.host = FIREBASE_HOST;
 fbConfig.api_key = ""; // left blank for public DB
 // For public DB, I pass nullptr as auth
 Firebase.begin(&fbConfig, nullptr);
 Firebase.reconnectWiFi(true);
}
void loop() {
 if (Firebase.setInt(fbData, "/testValue", millis()/1000)) {
 Serial.println("✅ Data written");
 } else {
 Serial.println("❌ Failed to write:");
 Serial.println(fbData.errorReason());
 }
 delay(5000);
}

Observed behavior / error messages:

Serial monitor shows:

✅ Wi-Fi Connected
❌ Failed to write:
token is not ready (revoked or expired)
❌ Failed to write:
token is not ready (revoked or expired
mkrieger1
24.2k7 gold badges68 silver badges84 bronze badges
asked Oct 17, 2025 at 12:48

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.