HTTPS Error
tcreis opened this issue · 25 comments
Hi,
I would report an issue that I am having.
Some times the script can provide the lat, long and accuracy values, but often I get
Latitude: 0.0000000
Longitude: 0.0000000
Accuracy: 40000
I understand that these values are the ones used in
typedef struct {
float lat = 0;
float lon = 0;
int accuracy = 40000;
} location_t;
I have uncommented line 12 in WifiLocation.h (//#define DEBUG_WIFI_LOCATION), and when it fails to report lan, long and accuracy there is the following indication
HTTPS ERROR
Nonetheless, when the process goes well, I can see a normal HTTP post which is aligned with this API. Not sure what is causing this. Can anyone provide support to solve this issue?
What I tried so far:
I added yield() after _client.println(request); (WifiLocation.cpp line 123) -> Problem not solved.
Hey guys,
i have exactly the same problem!
Getting the same values above like tcreis.
HTTPS Error sounds like a problem with the certificate which is provided within this package?
Maybe this needs to be refreshed?
Are you using esp8266 or esp32? Certificate check is only mandatory on esp32. I'll do a test and let you know the result. I will update certificate signature if it has changed.
I am using esp8266. As i mentioned i get zero degrees on both lat and long, acc is 40 :(
This happened spontanously and now its not gonna work well again.
Thank you for your help :)
This still does not work, billing account included, believe the certificate needs updating again
Still does not work.
- ESP8266 (NodeMCU V3)
- ArduinoIDE 1.8.5
- ESP8266 core for Arduino 2.5.0 beta2
with enable DEBUG:
HTTPS error
Location request data
16 WiFi networks found
WiFi list :
[
{"macAddress":"xx:xx:xx:xx:xx:xx","signalStrength":-69,"channel":1},
...
]
Latitude: 0.0000000
Longitude: 0.0000000
Accuracy: 40000
I also checked on "ESP8266 core for Arduino 2.4.2" and it works correctly.
"ESP8266 core for Arduino 2.5.0" creates problems.
On ESP32 work like charm.
I am facing the same problem
Hello,
Is a fix in the works? Should we fall back to 2.4.2?
I've just noticed what was the matter. Recent ESP8266 Arduino core updates has changed SSL library to BearSSL. This has a different security checks. I've just disabled Certificate check during HTTPS connection. It should work now
Hello Germán,
The good news... Issue is resolved. Thanks for your contributions to the Arduino community!
The not so good news... ESP8266 v.2.5.0 is not as stable as v.2.4.2. I spent nearly my entire Saturday dealing with WDT resets and other problems. I finally came back to v.2.4.2. My advice is to remain at v.2.4.2, until a future (stable) release is realized.
Best Regards
May you check if library compiles under esp8266 2.4.2? Or you are not using latest library version?
Hello Germán,
Latest version, WifiLocation 1.2.5, does not compile under esp8266 2.4.2. See attached error log.
I'm currently using WifiLocation 1.2.3 and esp8266 2.4.2. This combination works nicely.
I'll investigate if I can make it compatible. Newer features make use of BearSSL that is only present on 2.5.0. Thanks for testing
@Uup115 check latest commit on https://github.com/gmag11/WifiLocation/tree/dev branch. I've not tested it, but it compiles using 2.4.2. Check if it works.
Hello Germán,
Sorry, I've been busy this week. I'll check it on Saturday and let you know. Thanks!
Hello Germán,
With the latest commit, WifiLocation-dev, compilation fails using esp8266 2.4.2. See attached error log.
ErrorLog_ESP8266_242_WifiLocation_125_05-05-2019.txt
Hello Germán,
With the latest commit, WifiLocation-dev, compilation fails using esp8266 2.4.2. See attached error log.
ErrorLog_ESP8266_242_WifiLocation_125_05-05-2019.txt
Hi Germán, nice code!
I am having the very same error with cert . Any idea on how to solve?
going back to v 5.x resolves the issue.
Thanks!
I've found the reason of compile error. I was checking if bearssl.h was present to decide if using it or axTLS instead. The problem was that code 2.4.2 already implements bearSSL, although WiFiClientSecure
class uses axTLS.
I've not found any definition that allows me to identify what core version is used, so I had to add a define into WifiLocation.h
in dev branch.
It is on line 13. In order to compile with core < 2.5.0 this line should be uncommented.
If you know about a way to identify core version with preprocessor let me know, please.
I close this issue. Feel free to open it again
It seems like this is a bug with the ESP32. If you use the HTTPClient library in the Arduino_ESP core, you can successfully send a POST request without needing additional certificates.
Example:
WiFi.mode(WIFI_MODE_STA); // Set up device as WiFi station to find other devices
WiFi.begin(ssid, pass);
Serial.print("Attempting to connect to WPA SSID: ");
Serial.println(ssid);
while (WiFi.status() != WL_CONNECTED) {
// wait 5 seconds for connection:
Serial.print("Status = ");
Serial.println(WiFi.status());
delay(600);
}
String body = "{\"wifiAccessPoints\":" + getSurroundingWiFiJson() + "}";
#ifdef SERIAL_DEBUGGING
Serial.println(body);
#endif
// Send POST request to Google Service
HTTPClient goog;
String googlePath = "https://www.googleapis.com/geolocation/v1/geolocate?key=" + googleApiKey;
goog.begin(googlePath);
goog.addHeader("Content-Type","application/json", false, false);
int httpResp = goog.POST(body);
String payload = "Empty";
if (httpResp > 0) {
Serial.print("HTTP Response code: ");
Serial.println(httpResp);
payload = goog.getString();
}
else {
Serial.print("POST Error code: ");
Serial.println(httpResp);
}
goog.end();
From here you need to parse the JSON to get your values from the response. A disadvantage of this method is that is it not thread safe like the current implementation.
Hello everyone.
I had already made a geolocation code with this library, but for 2 days it no longer responds with the positioning or in other words I get the following error:
Location: 0.0000000,0.0000000 Accuracy: 40000 Result: API connection error
What should be done? Is there a problem with the certificate or in any case, would it be for another reason?
I will be attentive to your responses and comments.
Hello, I have tried to use the Wifilocation 1.2.9 library with an esp32, in the library I see that the certificate in the SCR folder is different from the certificate in the .cpp file. Can you explain to me how to make the library work correctly in esp32?
Location request data
[{"macAddress": "08: 3E: 0C: 81: B0: D0", "signalStrength": - 65, "channel": 8},
{"macAddress": "BC: 3E: 07: F6: 69: 98", "signalStrength": - 87, "channel": 6},
{"macAddress": "94: BF: 95: 6D: 57: 94", "signalStrength": - 92, "channel": 8},
{"macAddress": "20: AA: 4B: 60: CF: 61", "signalStrength": - 92, "channel": 11}]
Location: 0.0000000,0.0000000
Accuracy: 40000
Result: OK
Waiting for NTP time sync:
Current time: Sat Sep 4 18:18:27 2021
@alejolopez03 I explained how to get current certificate in https://github.com/gmag11/WifiLocation#description.
I already changed the certificates, and in one I get
-----BEGIN CERTIFICATE-----
MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkG
A1UEBhMCQkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jv
b3QgQ0ExGzAZBgNVBAMTEkdsb2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAw
MDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9i
YWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYDVQQDExJHbG9iYWxT
aWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDaDuaZ
jc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavp
xy0Sy6scTHAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp
1Wrjsok6Vjk4bwY8iGlbKk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdG
snUOhugZitVtbNV4FpWi6cgKOOvyJBNPc1STE4U6G7weNLWLBYy5d4ux2x8gkasJ
U26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrXgzT/LCrBbBlDSgeF59N8
9iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8E
BTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0B
AQUFAAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOz
yj1hTdNGCbM+w6DjY1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE
38NflNUVyRRBnMRddWQVDf9VMOyGj/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymP
AbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhHhm4qxFYxldBniYUr+WymXUad
DKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveCX4XSQRjbgbME
HMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A==
-----END CERTIFICATE-----
Result: API connection error
and with the other
-----BEGIN CERTIFICATE-----
MIIESjCCAzKgAwIBAgINAeO0mqGNiqmBJWlQuDANBg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vZy9y
ZXBvc2l0b3J5LzANBgkqhkiG9w0BAQsFAAOCAQEAGoA+Nnn78y6pRjd9XlQWNa7H
TgiZ/r3RNGkmUmYHPQq6Scti9PEajvwRT2iWTHQr02fesqOqBY2ETUwgZQ+lltoN
FvhsO9tvBCOIazpswWC9aJ9xju4tWDQH8NVU6YZZ/XteDSGU9YzJqPjY8q3MDxrz
mqepBCf5o8mw/wJ4a2G6xzUr6Fb6T8McDO22PLRL6u3M4Tzs3A2M1j6bykJYi8wW
IRdAvKLWZu/axBVbzYmqmwkm5zLSDW5nIAJbELCQCZwMH56t2Dvqofxs6BBcCFIZ
USpxu6x6td0V7SvJCCosirSmIatj/9dSSVDQibet8q/7UK4v4ZUN80atnZz1yg==
-----END CERTIFICATE-----
I get the following:
Connected
Waiting for NTP time sync: .
Current time: Sun Sep 5 06:05:27 2021
Location request data
[{"macAddress":"24:2E:02:01:F0:99","signalStrength":-68,"channel":6},
{"macAddress":"08:3E:0C:81:B0:D0","signalStrength":-69,"channel":8},
{"macAddress":"A4:98:13:7E:E0:AF","signalStrength":-95,"channel":11}]
Location: 0.0000000,0.0000000
Accuracy: 40000
Result: OK
NOTE: I am using version 1.2.9 of WifiLocation and ESP32
I already solved my problem, "I did not have a billing account associated with the API project"
Connected
Waiting for NTP time sync: .
Current time: Sun Sep 5 06:22:12 2021
Location request data
[{"macAddress":"08:3E:0C:81:B0:D0","signalStrength":-84,"channel":8}]
Location: 4.5383682,-75.6908035
Accuracy: 3560
Result: OK