How can I handle Firebase EMAIL_NOT FOUND Error Using ESP32?
My ESP32 give me error when the execution reach to Firebase.begin(&config, &auth). The attached screenshot show email not found error. But I need to perform interrupt Task in first priority to handle error. I want this because when ESP initializing the firebase (Firebase.begin(&config, &auth)), then it give me that error continuously and don't even execute the interrupt pin in first priority. When Interrupt happens then ESP will turn on Hotspot. But Due to this error it doesn't detect interrupt Pin when email is not in Firebase Authentication list. For correct email it works. I can't share all code here. Example code is below.
#include <Arduino.h>
#include <WiFi.h>
#include <FirebaseESP32.h>
#include <addons/TokenHelper.h>
#include <addons/RTDBHelper.h>
#define WIFI_SSID "3RD FLOOR (2.4GHz)"
#define WIFI_PASSWORD "green@1234"
#define API_KEY "AIzaSyDa..."
#define USER_EMAIL "myemail39933@gmail.com"
#define USER_PASSWORD "asdf1234"
// Insert RTDB URLefine the RTDB URL
#define DATABASE_URL "https://firebaseidappdomain.firebaseio.com"
FirebaseData fbdo;
FirebaseAuth auth;
FirebaseConfig config;
FirebaseData firebaseData;
#define BUTTON_PIN 13
void Access_Point() {
Serial.println("Access Point Triggered!");
}
volatile bool buttonState = false;
void IRAM_ATTR handleButtonInterrupt() {
// Read the state of the button
buttonState = digitalRead(BUTTON_PIN);
// Perform the necessary task based on the button state
if (buttonState == HIGH) {
Access_Point();
}
}
void setup()
{
Serial.begin(115200);
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
Serial.print("Connecting to Wi-Fi");
while (WiFi.status() != WL_CONNECTED)
{
Serial.print(".");
delay(300);
}
Serial.println();
Serial.print("Connected with IP: ");
Serial.println(WiFi.localIP());
Serial.println();
}
Serial.printf("Firebase Client v%s\n\n", FIREBASE_CLIENT_VERSION);
config.api_key = API_KEY;
auth.user.email = USER_EMAIL;
auth.user.password = USER_PASSWORD;
config.database_url = DATABASE_URL;
Firebase.reconnectNetwork(true);
fbdo.setBSSLBufferSize(4096 /* Rx buffer size in bytes from 512 - 16384 */, 1024 /* Tx buffer size in bytes from 512 - 16384 */);
fbdo.setResponseSize(4096);
String base_path = "/UsersData/";
config.token_status_callback = tokenStatusCallback;
if (Firebase.authenticated()) {
Serial.println("OKOKO.....");
} else {
Serial.println(firebaseData.errorReason());
delay(1000);
}
pinMode(BUTTON_PIN, INPUT);
attachInterrupt(digitalPinToInterrupt(BUTTON_PIN), handleButtonInterrupt, CHANGE);
// Firebase Initialization
Firebase.begin(&config, &auth);
}
void loop()
{
// My Loop Code
}
