diff --git a/README.md b/README.md index 2517d6d29..3bc9f8672 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Firebase Arduino Client Library for ESP8266 and ESP32 -Google's Firebase Arduino ClientLibrary for ESP8266 and ESP32 v 1.0.2 +Google's Firebase Arduino ClientLibrary for ESP8266 and ESP32 v 1.0.3 This library supports ESP8266 and ESP32 MCU from Espressif. The following are platforms in which libraries are also available. diff --git a/examples/Authentications/Custom_Token/Custom_Token.ino b/examples/Authentications/Custom_Token/Custom_Token.ino index 933117689..d6d16aa6c 100644 --- a/examples/Authentications/Custom_Token/Custom_Token.ino +++ b/examples/Authentications/Custom_Token/Custom_Token.ino @@ -280,8 +280,6 @@ void prepareDatabaseRules(const char *path, const char *var, const char *readVal //We will sign in using legacy token (database secret) for full RTDB access config.signer.tokens.legacy_token = FIREBASE_AUTH; Firebase.begin(&config, &auth); - //Set to empty string to sign in with other tokens - config.signer.tokens.legacy_token = ""; Serial.println("------------------------------------"); Serial.println("Read database ruless..."); @@ -343,6 +341,9 @@ void prepareDatabaseRules(const char *path, const char *var, const char *readVal { Serial.println("Failed to read the database rules, " + fbdo.errorReason()); } + + //Set to empty string to sign in with other tokens + config.signer.tokens.legacy_token = ""; } void printResult(FirebaseData &data) diff --git a/examples/Authentications/Custom_Token_from_File/Custom_Token_from_File.ino b/examples/Authentications/Custom_Token_from_File/Custom_Token_from_File.ino index 81e48f585..9072503a1 100644 --- a/examples/Authentications/Custom_Token_from_File/Custom_Token_from_File.ino +++ b/examples/Authentications/Custom_Token_from_File/Custom_Token_from_File.ino @@ -244,8 +244,6 @@ void prepareDatabaseRules(const char *path, const char *var, const char *readVal //We will sign in using legacy token (database secret) for full RTDB access config.signer.tokens.legacy_token = FIREBASE_AUTH; Firebase.begin(&config, &auth); - //Set to empty string to sign in with other tokens - config.signer.tokens.legacy_token = ""; Serial.println("------------------------------------"); Serial.println("Read database ruless..."); @@ -307,6 +305,9 @@ void prepareDatabaseRules(const char *path, const char *var, const char *readVal { Serial.println("Failed to read the database rules, " + fbdo.errorReason()); } + + //Set to empty string to sign in with other tokens + config.signer.tokens.legacy_token = ""; } void printResult(FirebaseData &data) diff --git a/examples/Authentications/Email_Password/Email_Password.ino b/examples/Authentications/Email_Password/Email_Password.ino index 2cd107005..d93b845e1 100644 --- a/examples/Authentications/Email_Password/Email_Password.ino +++ b/examples/Authentications/Email_Password/Email_Password.ino @@ -201,8 +201,6 @@ void prepareDatabaseRules(const char *path, const char *var, const char *readVal //We will sign in using legacy token (database secret) for full RTDB access config.signer.tokens.legacy_token = FIREBASE_AUTH; Firebase.begin(&config, &auth); - //Set to empty string to sign in with other tokens - config.signer.tokens.legacy_token = ""; Serial.println("------------------------------------"); Serial.println("Read database ruless..."); @@ -264,6 +262,9 @@ void prepareDatabaseRules(const char *path, const char *var, const char *readVal { Serial.println("Failed to read the database rules, " + fbdo.errorReason()); } + + //Set to empty string to sign in with other tokens + config.signer.tokens.legacy_token = ""; } void printResult(FirebaseData &data) diff --git a/library.properties b/library.properties index 747762f3e..976e634df 100644 --- a/library.properties +++ b/library.properties @@ -1,6 +1,6 @@ name=Firebase Arduino Client Library for ESP8266 and ESP32 -version=1.0.2 +version=1.0.3 author=Mobizt diff --git a/src/Firebase_ESP_Client.cpp b/src/Firebase_ESP_Client.cpp index ec779a709..b4ae090d3 100644 --- a/src/Firebase_ESP_Client.cpp +++ b/src/Firebase_ESP_Client.cpp @@ -1,5 +1,5 @@ /** - * Google's Firebase ESP Client Main class, Firebase_ESP_Client.cpp version 1.0.2 + * Google's Firebase ESP Client Main class, Firebase_ESP_Client.cpp version 1.0.3 * * This library supports Espressif ESP8266 and ESP32 * @@ -75,7 +75,9 @@ void Firebase_ESP_Client::begin(FirebaseConfig *config, FirebaseAuth *auth) _cfg->signer.tokens.status = token_status_uninitialized; } - if (Signer.tokenSigninDataReady()) + if (_cfg->signer.tokens.legacy_token.length() > 0) + Signer.setTokenType(token_type_legacy_token); + else if (Signer.tokenSigninDataReady()) { if (_auth->token.uid.length() == 0) Signer.setTokenType(token_type_oauth2_access_token); @@ -84,8 +86,6 @@ void Firebase_ESP_Client::begin(FirebaseConfig *config, FirebaseAuth *auth) } else if (Signer.userSigninDataReady()) Signer.setTokenType(token_type_id_token); - else if (_cfg->signer.tokens.legacy_token.length() > 0) - Signer.setTokenType(token_type_legacy_token); struct fb_esp_url_info_t uinfo; _cfg->_int.fb_auth_uri = _cfg->signer.tokens.token_type == token_type_legacy_token || _cfg->signer.tokens.token_type == token_type_id_token; diff --git a/src/Firebase_ESP_Client.h b/src/Firebase_ESP_Client.h index 30cac2b81..f3cbbcfb4 100644 --- a/src/Firebase_ESP_Client.h +++ b/src/Firebase_ESP_Client.h @@ -1,5 +1,5 @@ /** - * Google's Firebase ESP Client Main class, Firebase_ESP_Client.h version 1.0.2 + * Google's Firebase ESP Client Main class, Firebase_ESP_Client.h version 1.0.3 * * This library supports Espressif ESP8266 and ESP32 * diff --git a/src/README.md b/src/README.md index 722158733..1e5766e37 100644 --- a/src/README.md +++ b/src/README.md @@ -1,7 +1,7 @@ # Firebase Arduino Client Library for ESP8266 and ESP32 -Google's Firebase Arduino Client Library for ESP8266 and ESP32 v 1.0.2 +Google's Firebase Arduino Client Library for ESP8266 and ESP32 v 1.0.3 ## Global functions diff --git a/src/database/FB_RTDB.cpp b/src/database/FB_RTDB.cpp index fed9c67da..362266f7c 100644 --- a/src/database/FB_RTDB.cpp +++ b/src/database/FB_RTDB.cpp @@ -37,6 +37,7 @@ FB_RTDB::FB_RTDB() { + } FB_RTDB::~FB_RTDB() @@ -3801,7 +3802,7 @@ bool FB_RTDB::handleResponse(FirebaseData *fbdo) } dataTime = millis(); - + if (chunkBufSize > 1) { while (chunkBufSize > 0)