FirebaseExtended / firebase-arduino

Arduino samples for Firebase.
Apache License 2.0
943 stars 494 forks source link

Connection with firebase 2/27/2020 #476

Closed Hasan-75 closed 4 years ago

Hasan-75 commented 4 years ago

Unable to connect my ESP8266 to firebase realtime database. But till yesterday the system was working fine

bonz82 commented 4 years ago

I have the same problem

johnSU17 commented 4 years ago

Me,too.

ucar19 commented 4 years ago

I have same problem too. What happen could be?

hugolimachaves commented 4 years ago

Be aware that Firebase's fingerprint has changed again... Acordding to https://www.grc.com/fingerprints.htm, the current fingerprint is: 03:D6:42:23:03:D1:0C:06:73:F7:E2:BD:29:47:13:C3:22:71:37:1B More details about this issue, please reffer to: https://github.com/FirebaseExtended/firebase-arduino/issues/437

ucar19 commented 4 years ago

@hugolimachaves thank you. It works

danilomna commented 4 years ago

Hi, Please clarify something to me, what happens with all products on fields that are using this library with old fingerprint?

ucar19 commented 4 years ago

@danilomna They can't connect your firebase account. You must update them.

danilomna commented 4 years ago

@ucar19 then this is a terrible issue for a commercial IoT device. Let's say that have thousands and thousands sold and installed in customers house, would be a nightmare. How to workaround this and fix it for good?

ucar19 commented 4 years ago

@danilomna You had to set update system (OTA). After set you can update when you need.

Hasan-75 commented 4 years ago

Be aware that Firebase's fingerprint has changed again... Acordding to https://www.grc.com/fingerprints.htm, the current fingerprint is: 03:D6:42:23:03:D1:0C:06:73:F7:E2:BD:29:47:13:C3:22:71:37:1B More details about this issue, please reffer to: #437

Works. Thanks a lot

Decezaris commented 4 years ago

Guys, who wants to get the right fingerprint, you need to go in this website [https://www.grc.com/fingerprints.htm] and type the url database from your (or any) project (it is the same code for all).

danilomna commented 4 years ago

Guys, who wants to get the right fingerprint, you need to go in this website [https://www.grc.com/fingerprints.htm] and type the url database from your (or any) project (it is the same code for all).

@Decezaris that was I´m afraid off, so doesn´t matter the project url fingerprint is always same code to any project. That is pretty bad to IoT devices in field that were programmed with previous fingerprint and will stop working. Are there any way to not use the fingerprint while working with firebase realtime database??

danilomna commented 4 years ago

@danilomna They can't connect your firebase account. You must update them.

@ucar19, that would be a lot of work, and anyway will cause IoT devices stop working for a while. Are there any way to not use the fingerprint while working with firebase realtime database??

danilomna commented 4 years ago

Guys,

Problems solved!!! Forget about firebase fingetprint changes forever!!!

Use this and only this library avaliable on arduino library manager: Firebase ESP8266 Client.

An amazing project from @mobizt

https://github.com/mobizt/Firebase-ESP8266

HusseinSR commented 4 years ago

Guys,

Problems solved!!! Forget about firebase fingetprint changes forever!!!

Use this and only this library avaliable on arduino library manager: Firebase ESP8266 Client.

An amazing project from @mobizt

https://github.com/mobizt/Firebase-ESP8266

but the fingerprint still in firebase-arduino-master library

danilomna commented 4 years ago

Guys, Problems solved!!! Forget about firebase fingetprint changes forever!!! Use this and only this library avaliable on arduino library manager: Firebase ESP8266 Client. An amazing project from @mobizt https://github.com/mobizt/Firebase-ESP8266

but the fingerprint still in firebase-arduino-master library

Hi, I asked @mobizt about this here:

https://github.com/mobizt/Firebase-ESP8266/issues/88#issuecomment-592960574

And you can see it confirmed is not fingerprint dependent that for him is unacceptable, because this he designed this library, take a look there.

HusseinSR commented 4 years ago

Guys, Problems solved!!! Forget about firebase fingetprint changes forever!!! Use this and only this library avaliable on arduino library manager: Firebase ESP8266 Client. An amazing project from @mobizt https://github.com/mobizt/Firebase-ESP8266

but the fingerprint still in firebase-arduino-master library

Hi, I asked @mobizt about this here:

mobizt/Firebase-ESP8266#88 (comment)

And you can see it confirmed is not fingerprint dependent that for him is unacceptable, because this he designed this library, take a look there.

many thanks for your clarify, it mean that fire base not stop work with this library even using firebase-arduino library?

mobizt commented 4 years ago

@HusseinSR This is not a Firebase problem. The problem is the HTTP client library which this library used for server connection.

It uses a hard-coded fingerprint to compare with server (Firebase) fingerprint before sending any request if they do not match, the connection was canceled.

The fingerprint is the unique identifier of the server's certificate. If the SSL certificate of the server (Firebase for this case) has been renewed or replaced due to expired, the fingerprint of that certificate will be changed too.

Read this issue.

danilomna commented 4 years ago

@HusseinSR This is not a Firebase problem. The problem is the HTTP client library which this library used for server connection.

It uses a hard-coded fingerprint to compare with server (Firebase) fingerprint before sending any request if they do not match, the connection was canceled.

The fingerprint is the unique identifier of the server's certificate. If the SSL certificate of the server (Firebase for this case) has been renewed or replaced due to expired, the fingerprint of that certificate will be changed too.

Read this issue.

@mobizt what everybody wants to heard from you is you confirming using your library "Firebase ESP8266 Client" in the IoT device it will not stop working anymore when fingerprint change in future. Could you kindly confirm that?

mobizt commented 4 years ago

@danilomna

My library works in different approaches to communicate with Firebase. The fingerprint is not related to my library in any way because my library doesn't use a fingerprint to work.

The fingerprint is not secure and not recommended. I don't want to promote my library here unless to explain fingerprint usage.

yhua537 commented 4 years ago

I am a bit disappointed that this library is not moving forward at all for past 12 months.

You can change in your arduino core library to disable the verification, but this is not recommended.

I did some work and attempt to improve this last year by checking the root certificate, which it is not suppose to be change frequently and you will have to past in few more parameters to reduce memory usage, I suppose (not verified) it is similar to @mobizt 's solution . Haven't got much time doing it lately but if anyone wants to test/improve from here, I am happy anyone wants it. it is not very stable as the memory would be running out from time to time. The fork is under https://github.com/yhua537/firebase-arduino. I am using this with arduino core 2.5.0, earlier version doesn't work as the memory issue.

Will check out @mobizt 's solution when I have time.

mobizt commented 4 years ago

@yhua537 My library was written from scratch. It has almost different API and functions and not a solution to this library because it's not compatible.

User needs to learn before use.

yhua537 commented 4 years ago

@mobizt

Yes, notice that. but your approach on using root cert is very similar, but you are using axtls but mine is forcing to use BearSSL.

mobizt commented 4 years ago

@yhua537 No, my library supports BearSSL by default. The axTLS will use in my library if ESP8266 Arduino Core SDK v 2.4.x and lower was installed.

Don't conclude about my library If you don't test it.

yhua537 commented 4 years ago

@mobizt Right, I am only guessing with 5 minute of checking your library. I will stop my guessing and will try yours when I have time. Interested to find out how you make it work with limited memory and cpu power.

Mine has all kind of problem that the current main fork has, but workable for me since June last year. Putting it out there and hoping someone can improve.

mobizt commented 4 years ago

@yhua537 I investigate your library and found you use token that you named refresh token instead of database secret which differs from the original one.

If you want to create the custom token for Firebase authentication, jwt is the better way. The mbedTLS (ported to ESP32) has a tool to encrypt this token.

HusseinSR commented 4 years ago

@HusseinSR This is not a Firebase problem. The problem is the HTTP client library which this library used for server connection.

It uses a hard-coded fingerprint to compare with server (Firebase) fingerprint before sending any request if they do not match, the connection was canceled.

The fingerprint is the unique identifier of the server's certificate. If the SSL certificate of the server (Firebase for this case) has been renewed or replaced due to expired, the fingerprint of that certificate will be changed too.

Read this issue.

the first i edit the file WiFiClientSecureAxTLS.cpp line 723 to bool WiFiClientSecure::verify(const char fp, const char domain_name) { return true; //<--- here
but is not work

the second

i try to use your library in my project without change of the structure of firebase code but is get wrong message (no matching function for call to 'FirebaseESP8266::setInt(const char [3], int)

what is code in your library to get or set value for this examble Firebase.setInt("S1",0); Firebase.getString("S2").toInt(); regards

mobizt commented 4 years ago

@HusseinSR I already said my library API and functions are almost different. You can read the readme doc or try the examples first.

yhua537 commented 4 years ago

@mobizt yep, i am not using the database secret as that stops me from using different password for each device.

I would love to get JWT working with Json/flutter, but with my current setup with ESP8266, it is limiting me from taking on more libraries. Yes, that may kill my setup and force me to move to ESP32 in near future as I am not mentally ready to throw away my 12 ESP-01 yet.

BaraiSimal commented 4 years ago

Changing fingerprint worked for me

danilomna commented 4 years ago

Changing fingerprint worked for me

We know if changes will work, but that is not the point, we dont want to be fingerprint dependant anymore. Because this @mobizt is very interesting.

HusseinSR commented 4 years ago

@HusseinSR I already said my library API and functions are almost different. You can read the readme doc or try the examples first.

yes i understood that, but excuse me i still beginner my i build my project IOT since one year ago, and it was working with old library by read/update values by using simple structure as mention above i try the examples but can not find some thing match to rebuild my project can you help me by simple code for on/off led for example by Firebase many thanks for assistance

HusseinSR commented 4 years ago

Changing fingerprint worked for me

We know if changes will work, but that is not the point, we dont want to be fingerprint dependant anymore. Because this @mobizt is very interesting.

can you help me by simple code for on/off led for example by new Firebase i using simple android app created by MIT inventor to do that bey old Firebase library

mobizt commented 4 years ago

@HusseinSR This is the simple working example to control the LED in realtime.

For your simple needs.


//Declare the FirebaseData object for data sending and receiving operation
FirebaseData firebaseData;

void setup()
{

  if (!Firebase.setInt(firebaseData, "S1", 0)) {
    //Error?
    Serial.println(firebaseData.errorReason());
  }

  if (!Firebase.getInt(firebaseData, "S2")) {
    //Error?
    Serial.println(firebaseData.errorReason());
  }

  //read the int data from firebaseData object after call getInt
  int myInt = firebaseData.intData();

}
HusseinSR commented 4 years ago

@HusseinSR This is the simple working example to control the LED in realtime.

For your simple needs.


//Declare the FirebaseData object for data sending and receiving operation
FirebaseData firebaseData;

void setup()
{

  if (!Firebase.setInt(firebaseData, "S1", 0)) {
    //Error?
    Serial.println(firebaseData.errorReason());
  }

  if (!Firebase.getInt(firebaseData, "S2")) {
    //Error?
    Serial.println(firebaseData.errorReason());
  }

  //read the int data from firebaseData object after call getInt
  int myInt = firebaseData.intData();

}

many many thanks, now it is match with my project and working ..... :) :)

adelinasimanjuntak commented 3 years ago

Hi, I'm using ESP8266 and have just updated my firebase fingerprint but the esp still not connecting to the firebase. Any idea? I'm very new to this. tx