firebase-arduino
firebase-arduino copied to clipboard
Has anyone had problems with your Nodemcu and Firebase connection?
Hi. Has anyone had problems with your Nodemcu and Firebase connection? everything worked correctly until today.
Is someone having this problem?
Yes, I cant connect..
firebase has new fingerprint => 6F D0 9A 52 C0 E9 E4 CD A0 D3 02 A4 B7 A1 92 38 2D CA 2F 26
just edit this file, FirebaseHttpClient.h
Works correctly !! Thank you @adamrabbani :)
Thank you so much @adamrabbani !!!!!!!!!!!!!!!!!!!!
@adamrabbani Thank you so much
Damm!! Thank you a lot bro
This is my own solutions to handle the fingerprint changes Solution 1
-
Create php file on web server that will provide firebaseio.com fingerprint via get request which the host to get fingerprint is test.firebaseio.com
-
Modify FirebaseHttpClient_Esp8266.cpp from line no. 22
public:
FirebaseHttpClientEsp8266() {}
to
public:
String fingerprint;
FirebaseHttpClientEsp8266() {
http_.begin("http://{YOUR WEB SERVER}.com/fingerprint.php?host=test.firebaseio.com");
int httpCode = http_.GET();
if (httpCode == HTTP_CODE_OK)
fingerprint = http_.getString();
http_.end();
}
and from line no. 46
void begin(const std::string& url) override {
http_.begin(url.c_str(), kFirebaseFingerprint);
}
void begin(const std::string& host, const std::string& path) override {
http_.begin(host.c_str(), kFirebasePort, path.c_str(), kFirebaseFingerprint);
}
to
void begin(const std::string& url) override {
http_.begin(url.c_str(), fingerprint);
}
void begin(const std::string& host, const std::string& path) override {
http_.begin(host.c_str(), kFirebasePort, path.c_str(), fingerprint);
}
This is fingerprint.php file
<?php
# PHP SSL Fingerprint Checker written by W. Al Maawali
# (c) 2013 Founder of Eagle Eye Digital Solutions
# http://www.digi77.com
# http://www.om77.net
# script starts here:
# Usage: http://www.yourdomain.com/sslf.php
# Example: http://www.digi77.com/software/fingerprint/fp-public.php?hosts=www.facebook.com
//avoid timeouts
set_time_limit(0);
//For String variable use prevent sql injections
function StringInputCleaner($data)
{
$data = trim($data);
$data = stripslashes($data);
$data=(filter_var($data, FILTER_SANITIZE_STRING));
return $data;
}
function getSllCertificate($hostname, $port = 443)
{
$context = stream_context_create(array("ssl" => array("capture_peer_cert" => true)));
$socket = @stream_socket_client("ssl://$hostname:$port", $errno, $errstr, ini_get("default_socket_timeout"), STREAM_CLIENT_CONNECT, $context);
if(!$socket)
return array("md5" => "error", "sha1" => "error");
$contextdata = stream_context_get_params($socket);
$contextparams = $contextdata['options']['ssl']['peer_certificate'];
fclose($socket);
openssl_x509_export($contextparams, $cert, true);
openssl_x509_free($contextparams);
$repl = array("\r", "\n", "-----BEGIN CERTIFICATE-----", "-----END CERTIFICATE-----");
$repw = array("", "", "", "");
$cert = str_replace($repl, $repw, $cert);
$decoded = base64_decode($cert);
$fingerprints = array(
"md5" => md5($decoded),
"sha1" => sha1($decoded),
);
return $fingerprints ;
}
$host=$_GET['host'];
//clean string safer coding
$host=StringInputCleaner($host);
$port=443;
$hashes = getSllCertificate($host, $port);
echo($hashes['sha1']);
?>
Solution 2
Bypass the finger print verification in WiFiClientSecure.cpp in C:\Users{YOUR NAME}\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\libraries\ESP8266WiFi\src
from line no. 630 to
bool WiFiClientSecure::verify(const char* fp, const char* domain_name)
{
return trure;
@adamrabbani GOD BLESS!!!!!! We have a project due on monday (3 days from this post) and randomly our firebase started failing. God bless you, God bless your family, god bless your ancestors.
@adamrabbani jesus christ god bless indeed. That was really scary. Whats the scoop on this?
@adamrabbani I have changed the fingerprint, but it's still not working. Did I miss anything?
@arkochatterjee I've the same issue...but the fingerprint for me is already correct.
I have the same issue. I changed the fingerprint, but its still not working, It begins connection and starts streaming. Then Unable to get/read Data from firebase and firebase Stream is failing. Tried updating ArduinoJson as well no use.
Does Anyone know the solution ?
hi @adamrabbani hope you doing well can you plz tell that where i found firebasehttp.client.h. your answer would be highly appreciated
@hammad42
You can find that file inside libraries folder of Arduino.
Libraries-> firebase-arduino-master -> src-> firebasehttp.client.h
thankyou @santoshn547 but finger print is already same as above which is wrote by @adamrabbani
@santoshn547 if you found any success plz share it with me i have submit my fyp project and i stuck on this my code was works fine then this shit happens..
@JaysArtwork did you find any success..
@hammad42 Even I haven't found any solution !
@hammad42 I did not find any solution...damn
Ok @JaysArtworks@Santoshn547 do one thing download old library and go to firebase http client.h and edit finger print as above adamrabbani shows
@adamrabbani @ Thank you very much my friend. You save my project. I have try many weeks ago. Now it work fine. Many many thank.
@adamrabbani @ how can we know that firebase change that? If later firebase change again, where can we find it?
@kimleng-ly you can check fingerprint through this site https://www.grc.com/fingerprints.htm?domain=yourdatabase.firebaseio.com
For test you can use https://www.grc.com/fingerprints.htm?domain=test.firebaseio.com.
If you read my post above, solution 1 (if you have PHP skill) is for automatically update fingerprint when your device start to connect to firebase.
In case of you want to bypass fingerprint checking please see solution 2 of my previous post.
@mobizt Many thank my friend. You save a lot time for me to search it. Thank.
Good day, replaced the code, the application runs 2-3 minutes, after writing: DB failed. What is the solution ?
6F D0 9A 52 C0 E9 E4 CD A0 D3 02 A4 B7 A1 92 38 2D CA 2F 26
file FirebaseHttpClient.h edited
@AlexPivo If you want to by pass fingerprint verification, write "return true;" first inside the function and no need to edit finger print in FirebaseHttpClient.h.
bool WiFiClientSecure::verify(const char* fp, const char* domain_name)
{
return true; //<--- here
if (!_ssl) {
return false;
}
Thanks, it's working. Works 2-3 minutes, then error. Crash controller (freezes controller ) and start working again in 2-3 minutes.
p.s. Error not writes: DB failed
the library should be inside the Document/Arduino/libraries, not the program files, it should be the same file of your project saved in. This works for me.
Can you confirm that was fixed with https://github.com/firebase/firebase-arduino/pull/368 ?
@mobizt Good day, it's working. The problem was wi-Fi.
option 2: Bypass the finger print verification in WiFiClientSecure.cpp in C:\Users{YOUR NAME}\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0\libraries\ESP8266WiFi\src
bool WiFiClientSecure::verify(const char* fp, const char* domain_name) { return true; //<--- here
if (!_ssl) {
return false;
}
Thanks!