c++cfirebasearduinoesp32

ESP32 Firebase: authenticating results in error code 400 - but Firebase does recognize my login


I am trying to authenticate using signIn() method and exact replica of example code from ESP32 Client library (the new version)

In my serial monitor I can read that the error code is 400 this:

enter image description here

enter image description here

Code that I am using:

Serial.printf("Firebase Client v%s\n\n", FIREBASE_CLIENT_VERSION);

/* Assign the api key (required) */
fb_config.api_key = API_KEY;

/* Assign the user sign in credentials */
fb_auth.user.email = email_name.c_str();
fb_auth.user.password = email_name.c_str();

/* Assign the RTDB URL */
fb_config.database_url = DATABASE_URL;

Firebase.reconnectWiFi(true);
fb_do.setResponseSize(4096);

/* Assign the callback function for the long running token generation task */
fb_config.token_status_callback = tokenStatusCallback; //see addons/TokenHelper.h

/** Assign the maximum retry of token generation */
fb_config.max_token_generation_retry = 5;

/* Initialize the library with the Firebase authen and config */
Firebase.begin(&fb_config, &fb_auth);

if(Firebase.authenticated()){
  Serial.println("I am authenticated");
} else {
  Serial.println("Well I AM NOT???");
}

Screenshot from my Firebase authentication that my ESP32 was created and also logged in today:

enter image description here

I know my Firebase initialization was successful because I can read and write read data into the Realtime database:

enter image description here

I am using PlatformIO and this is my config file:

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 115200
build_flags = -D PIO_FRAMEWORK_ARDUINO_MMU_CACHE16_IRAM48_SECHEAP_SHARED
lib_deps = 
    mobizt/Firebase Arduino Client Library for ESP8266 and ESP32@^2.5.4
    bblanchon/ArduinoJson@^6.18.5

Solution

  • GitHub discussion where we find the solution.