witnessmenow / arduino-sample-api-request

24 stars 15 forks source link

UNABLE TO CONNECT TO GOOGLE SHEETS API #1

Open vtronicsautomation opened 4 years ago

vtronicsautomation commented 4 years ago

`/*** A sample project for making a HTTP/HTTPS GET request on an ESP8266

It will connect to the given request and print the body to
serial monitor

Parts:
D1 Mini ESP8266 * - http://s.click.aliexpress.com/e/uzFUnIe

// ---------------------------- // Standard Libraries // ----------------------------

include

include

//------- Replace the following! ------ char ssid[] = "GAMING-PC"; // your network SSID (name) char password[] = "alienWARE"; // your network key

// For Non-HTTPS requests // WiFiClient client;

// For HTTPS requests WiFiClientSecure client;

// Just the base of the URL you want to connect to

define TEST_HOST "https://script.google.com"

// OPTIONAL - The finferprint of the site you want to connect to. (FP from my response api)

define TEST_HOST_FINGERPRINT "BD 84 93 D6 8E 68 22 F2 B6 C5 74 3E 22 D7 EB F4 79 6A EA 2E"

void setup() {

Serial.begin(115200);

// Connect to the WiFI WiFi.mode(WIFI_STA); WiFi.disconnect(); delay(100);

// Attempt to connect to Wifi network: Serial.print("Connecting Wifi: "); Serial.println(ssid); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { Serial.print("."); delay(500); } Serial.println(""); Serial.println("WiFi connected"); Serial.println("IP address: "); IPAddress ip = WiFi.localIP(); Serial.println(ip);

//--------

// If you don't need to check the fingerprint // client.setInsecure();

// If you want to check the fingerprint client.setFingerprint(TEST_HOST_FINGERPRINT);

makeHTTPRequest(); }

void makeHTTPRequest() {

// Opening connection to server (Use 80 as port if HTTP) if (!client.connect(TEST_HOST, 443)) { Serial.println(F("Connection failed")); return; }

// give the esp a breather yield();

// Send HTTP request client.print(F("GET ")); // This is the second half of a request (everything that comes after the base URL) client.print("/macros/s/I_HAVE_USED_MY_SHEET_ID_HERE/exec?sheetname=GOLD_DEVICE&action=reg&reg=CC:50:E3:5D:2C:F5"); client.println(F(" HTTP/1.1"));

//Headers client.print(F("Host: ")); client.println(TEST_HOST);

client.println(F("Cache-Control: no-cache"));

if (client.println() == 0) { Serial.println(F("Failed to send request")); return; } //delay(100); // Check HTTP status char status[32] = {0}; client.readBytesUntil('\r', status, sizeof(status)); if (strcmp(status, "HTTP/1.1 200 OK") != 0) { Serial.print(F("Unexpected response: ")); Serial.println(status); return; }

// Skip HTTP headers char endOfHeaders[] = "\r\n\r\n"; if (!client.find(endOfHeaders)) { Serial.println(F("Invalid response")); return; }

// This is probably not needed for most, but I had issues // with the Tindie api where sometimes there were random // characters coming back before the body of the response. // This will cause no hard to leave it in // peek() will look at the character, but not take it off the queue while (client.available() && client.peek() != '{') { char c = 0; client.readBytes(&c, 1); Serial.print(c); Serial.println("BAD"); }

// While the client is still availble read each // byte and print to the serial monitor while (client.available()) { char c = 0; client.readBytes(&c, 1); Serial.print(c); } }

void loop() { // put your main code here, to run repeatedly:

}`

CONSOLE OUTPUT HERE 14:34:47.964 -> SDK:2.2.1(cfd48f3)/Core:2.5.2=20502000/lwIP:STABLE-2_1_2_RELEASE/glue:1.1-7-g82abda3/BearSSL:a143020 14:34:47.964 -> bcn 0 14:34:47.964 -> del if1 14:34:47.964 -> usl 14:34:47.964 -> mode : sta(cc:50:e3:5d:2c:f2) 14:34:47.964 -> add if0 14:34:48.132 -> wifi evt: 8 14:34:48.236 -> Connecting Wifi: GAMING-PC 14:34:48.304 -> ....wifi evt: 2 14:34:50.305 -> ..scandone 14:34:52.134 -> state: 0 -> 2 (b0) 14:34:52.134 -> .state: 2 -> 3 (0) 14:34:52.134 -> state: 3 -> 5 (10) 14:34:52.134 -> add 0 14:34:52.134 -> aid 2 14:34:52.134 -> cnt 14:34:52.203 -> 14:34:52.203 -> connected with GAMING-PC, channel 11 14:34:52.269 -> dhcp client start... 14:34:52.269 -> wifi evt: 0 14:34:52.610 -> ....ip:192.168.1.145,mask:255.255.255.0,gw:192.168.1.100 14:34:54.131 -> wifi evt: 3 14:34:54.608 -> 14:34:54.608 -> WiFi connected 14:34:54.608 -> IP address: 14:34:54.608 -> 192.168.1.145 14:34:54.608 -> [hostByName] request IP for: https://script.google.com 14:34:54.676 -> [hostByName] Host: https://script.google.com lookup error: -5! 14:34:54.676 -> BSSL:connect: Name loopup failure 14:34:54.676 -> Connection failed 14:35:02.122 -> pm open,type:2 0

I have been surfing internet all over for this error past 10 days still i could not find a solution for it. is there any solution for this.

witnessmenow commented 4 years ago

I haven't had a big look, but the host define looks wrong. It should not have Https in front of it.

On Tue, 19 Nov 2019, 09:14 vtronicsautomation, notifications@github.com wrote:

`/*** A sample project for making a HTTP/HTTPS GET request on an ESP8266

It will connect to the given request and print the body to serial monitor

Parts: D1 Mini ESP8266 * - http://s.click.aliexpress.com/e/uzFUnIe

-

// ---------------------------- // Standard Libraries // ----------------------------

include

include

//------- Replace the following! ------ char ssid[] = "GAMING-PC"; // your network SSID (name) char password[] = "alienWARE"; // your network key

// For Non-HTTPS requests // WiFiClient client;

// For HTTPS requests WiFiClientSecure client;

// Just the base of the URL you want to connect to

define TEST_HOST "https://script.google.com"

// OPTIONAL - The finferprint of the site you want to connect to. (FP from my response api)

define TEST_HOST_FINGERPRINT "BD 84 93 D6 8E 68 22 F2 B6 C5 74 3E 22 D7

EB F4 79 6A EA 2E"

void setup() {

Serial.begin(115200);

// Connect to the WiFI WiFi.mode(WIFI_STA); WiFi.disconnect(); delay(100);

// Attempt to connect to Wifi network: Serial.print("Connecting Wifi: "); Serial.println(ssid); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { Serial.print("."); delay(500); } Serial.println(""); Serial.println("WiFi connected"); Serial.println("IP address: "); IPAddress ip = WiFi.localIP(); Serial.println(ip);

//--------

// If you don't need to check the fingerprint // client.setInsecure();

// If you want to check the fingerprint client.setFingerprint(TEST_HOST_FINGERPRINT);

makeHTTPRequest(); }

void makeHTTPRequest() {

// Opening connection to server (Use 80 as port if HTTP) if (!client.connect(TEST_HOST, 443)) { Serial.println(F("Connection failed")); return; }

// give the esp a breather yield();

// Send HTTP request client.print(F("GET ")); // This is the second half of a request (everything that comes after the base URL)

client.print("/macros/s/I_HAVE_USED_MY_SHEET_ID_HERE/exec?sheetname=GOLD_DEVICE&action=reg&reg=CC:50:E3:5D:2C:F5"); client.println(F(" HTTP/1.1"));

//Headers client.print(F("Host: ")); client.println(TEST_HOST);

client.println(F("Cache-Control: no-cache"));

if (client.println() == 0) { Serial.println(F("Failed to send request")); return; } //delay(100); // Check HTTP status char status[32] = {0}; client.readBytesUntil('\r', status, sizeof(status)); if (strcmp(status, "HTTP/1.1 200 OK") != 0) { Serial.print(F("Unexpected response: ")); Serial.println(status); return; }

// Skip HTTP headers char endOfHeaders[] = "\r\n\r\n"; if (!client.find(endOfHeaders)) { Serial.println(F("Invalid response")); return; }

// This is probably not needed for most, but I had issues // with the Tindie api where sometimes there were random // characters coming back before the body of the response. // This will cause no hard to leave it in // peek() will look at the character, but not take it off the queue while (client.available() && client.peek() != '{') { char c = 0; client.readBytes(&c, 1); Serial.print(c); Serial.println("BAD"); }

// While the client is still availble read each // byte and print to the serial monitor while (client.available()) { char c = 0; client.readBytes(&c, 1); Serial.print(c); } }

void loop() { // put your main code here, to run repeatedly:

}`

CONSOLE OUTPUT HERE 14:34:47.964 -> SDK:2.2.1(cfd48f3)/Core:2.5.2=20502000/lwIP:STABLE-2_1_2_RELEASE/glue:1.1-7-g82abda3/BearSSL:a143020 14:34:47.964 -> bcn 0 14:34:47.964 -> del if1 14:34:47.964 -> usl 14:34:47.964 -> mode : sta(cc:50:e3:5d:2c:f2) 14:34:47.964 -> add if0 14:34:48.132 -> wifi evt: 8 14:34:48.236 -> Connecting Wifi: GAMING-PC 14:34:48.304 -> ....wifi evt: 2 14:34:50.305 -> ..scandone 14:34:52.134 -> state: 0 -> 2 (b0) 14:34:52.134 -> .state: 2 -> 3 (0) 14:34:52.134 -> state: 3 -> 5 (10) 14:34:52.134 -> add 0 14:34:52.134 -> aid 2 14:34:52.134 -> cnt 14:34:52.203 -> 14:34:52.203 -> connected with GAMING-PC, channel 11 14:34:52.269 -> dhcp client start... 14:34:52.269 -> wifi evt: 0 14:34:52.610 -> ....ip:192.168.1.145,mask:255.255.255.0,gw:192.168.1.100 14:34:54.131 -> wifi evt: 3 14:34:54.608 -> 14:34:54.608 -> WiFi connected 14:34:54.608 -> IP address: 14:34:54.608 -> 192.168.1.145 14:34:54.608 -> [hostByName] request IP for: https://script.google.com 14:34:54.676 -> [hostByName] Host: https://script.google.com lookup error: -5! 14:34:54.676 -> BSSL:connect: Name loopup failure 14:34:54.676 -> Connection failed 14:35:02.122 -> pm open,type:2 0

I have been surfing internet all over for this error past 10 days still i could not find a solution for it. is there any solution for this.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/witnessmenow/arduino-sample-api-request/issues/1?email_source=notifications&email_token=AAL5PQSM4WCFSKI73C2MTRTQUOU5XA5CNFSM4JPAFIDKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4H2I5WTA, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAL5PQRGOTBIZVDX37TNE53QUOU5XANCNFSM4JPAFIDA .

vtronicsautomation commented 4 years ago

Thank you so much for your reply brain

`// Just the base of the URL you want to connect to

define TEST_HOST "www.script.google.com"`

SERIAL MONITOR O/P:

14:45:56.693 -> SDK:2.2.1(cfd48f3)/Core:2.5.2=20502000/lwIP:STABLE-2_1_2_RELEASE/glue:1.1-7-g82abda3/BearSSL:a143020 14:45:56.693 -> bcn 0 14:45:56.693 -> del if1 14:45:56.693 -> usl 14:45:56.693 -> mode : sta(cc:50:e3:5d:2c:f2) 14:45:56.693 -> add if0 14:45:56.861 -> wifi evt: 8 14:45:56.963 -> Connecting Wifi: GAMING-PC 14:45:57.031 -> ....wifi evt: 2 14:45:59.053 -> ..scandone 14:46:00.861 -> state: 0 -> 2 (b0) 14:46:00.861 -> .state: 2 -> 3 (0) 14:46:00.861 -> state: 3 -> 5 (10) 14:46:00.861 -> add 0 14:46:00.861 -> aid 2 14:46:00.861 -> cnt 14:46:00.928 -> 14:46:00.928 -> connected with GAMING-PC, channel 11 14:46:01.033 -> dhcp client start... 14:46:01.033 -> wifi evt: 0 14:46:01.376 -> ....ip:192.168.1.145,mask:255.255.255.0,gw:192.168.1.100 14:46:02.861 -> wifi evt: 3 14:46:03.369 -> 14:46:03.369 -> WiFi connected 14:46:03.369 -> IP address: 14:46:03.369 -> 192.168.1.145 14:46:03.369 -> [hostByName] request IP for: www.script.google.com 14:46:03.369 -> [hostByName] Host: www.script.google.com IP: 74.125.130.189 14:46:03.369 -> :ref 1 14:46:03.438 -> BSSL:_connectSSL: start connection 14:46:03.438 -> :wr 226 0 14:46:03.438 -> :wrc 226 226 0 14:46:03.506 -> :ack 226 14:46:03.506 -> :rn 536 14:46:03.506 -> :rch 536, 536 14:46:03.506 -> :rch 1072, 536 14:46:03.506 -> :rch 1608, 536 14:46:03.506 -> :rd 5, 2144, 0 14:46:03.506 -> :rdi 536, 5 14:46:03.506 -> :rd 87, 2144, 5 14:46:03.506 -> :rdi 531, 87 14:46:03.506 -> :rd 5, 2144, 92 14:46:03.506 -> :rdi 444, 5 14:46:03.506 -> :rd 2047, 2144, 97 14:46:03.506 -> :rdi 439, 439 14:46:03.506 -> :c 439, 536, 2144 14:46:03.506 -> :rdi 536, 536 14:46:03.506 -> :c 536, 536, 1608 14:46:03.506 -> :rdi 536, 536 14:46:03.506 -> :c 536, 536, 1072 14:46:03.506 -> :rdi 536, 536 14:46:03.548 -> :c0 536, 536 14:46:03.575 -> :rn 536 14:46:03.575 -> :rch 536, 536 14:46:03.575 -> :rch 1072, 2 14:46:03.610 -> :rd 760, 1074, 0 14:46:03.610 -> :rdi 536, 536 14:46:03.610 -> :c 536, 536, 1074 14:46:03.610 -> :rdi 536, 224 14:46:03.610 -> BSSL:insecure_end_chain: Received cert FP doesn't match 14:46:03.610 -> BSSL:_wait_for_handshake: failed 14:46:03.610 -> BSSL:Couldn't connect. Error = 'Chain could not be linked to a trust anchor.' 14:46:03.610 -> Connection failed 14:46:10.872 -> pm open,type:2 0 14:46:13.540 -> :rcl 14:46:13.540 -> :abort

I tried to replace https with www too but still i get handshake failed from this i guess there is some sort of certificate issue. i have also attached the certificate value i got from my web browser.

i tried connecting to host in all possible ways but still i did not find a solution

https://script.google.com http://script.google.com www.script.google.com

nothing worked for me.i really don't understand where am i lagging. is there any other host name for google sheets?

certificate

witnessmenow commented 4 years ago

Try use "script.google.com"

On Tue, 19 Nov 2019, 09:42 vtronicsautomation, notifications@github.com wrote:

Thank you so much for your reply brain

// Just the base of the URL you want to connect to #define TEST_HOST " www.script.google.com"

SERIAL MONITOR O/P:

14:45:56.693 -> SDK:2.2.1(cfd48f3)/Core:2.5.2=20502000/lwIP:STABLE-2_1_2_RELEASE/glue:1.1-7-g82abda3/BearSSL:a143020 14:45:56.693 -> bcn 0 14:45:56.693 -> del if1 14:45:56.693 -> usl 14:45:56.693 -> mode : sta(cc:50:e3:5d:2c:f2) 14:45:56.693 -> add if0 14:45:56.861 -> wifi evt: 8 14:45:56.963 -> Connecting Wifi: GAMING-PC 14:45:57.031 -> ....wifi evt: 2 14:45:59.053 -> ..scandone 14:46:00.861 -> state: 0 -> 2 (b0) 14:46:00.861 -> .state: 2 -> 3 (0) 14:46:00.861 -> state: 3 -> 5 (10) 14:46:00.861 -> add 0 14:46:00.861 -> aid 2 14:46:00.861 -> cnt 14:46:00.928 -> 14:46:00.928 -> connected with GAMING-PC, channel 11 14:46:01.033 -> dhcp client start... 14:46:01.033 -> wifi evt: 0 14:46:01.376 -> ....ip:192.168.1.145,mask:255.255.255.0,gw:192.168.1.100 14:46:02.861 -> wifi evt: 3 14:46:03.369 -> 14:46:03.369 -> WiFi connected 14:46:03.369 -> IP address: 14:46:03.369 -> 192.168.1.145 14:46:03.369 -> [hostByName] request IP for: www.script.google.com 14:46:03.369 -> [hostByName] Host: www.script.google.com IP: 74.125.130.189 14:46:03.369 -> :ref 1 14:46:03.438 -> BSSL:_connectSSL: start connection 14:46:03.438 -> :wr 226 0 14:46:03.438 -> :wrc 226 226 0 14:46:03.506 -> :ack 226 14:46:03.506 -> :rn 536 14:46:03.506 -> :rch 536, 536 14:46:03.506 -> :rch 1072, 536 14:46:03.506 -> :rch 1608, 536 14:46:03.506 -> :rd 5, 2144, 0 14:46:03.506 -> :rdi 536, 5 14:46:03.506 -> :rd 87, 2144, 5 14:46:03.506 -> :rdi 531, 87 14:46:03.506 -> :rd 5, 2144, 92 14:46:03.506 -> :rdi 444, 5 14:46:03.506 -> :rd 2047, 2144, 97 14:46:03.506 -> :rdi 439, 439 14:46:03.506 -> :c 439, 536, 2144 14:46:03.506 -> :rdi 536, 536 14:46:03.506 -> :c 536, 536, 1608 14:46:03.506 -> :rdi 536, 536 14:46:03.506 -> :c 536, 536, 1072 14:46:03.506 -> :rdi 536, 536 14:46:03.548 -> :c0 536, 536 14:46:03.575 -> :rn 536 14:46:03.575 -> :rch 536, 536 14:46:03.575 -> :rch 1072, 2 14:46:03.610 -> :rd 760, 1074, 0 14:46:03.610 -> :rdi 536, 536 14:46:03.610 -> :c 536, 536, 1074 14:46:03.610 -> :rdi 536, 224 14:46:03.610 -> BSSL:insecure_end_chain: Received cert FP doesn't match 14:46:03.610 -> BSSL:_wait_for_handshake: failed 14:46:03.610 -> BSSL:Couldn't connect. Error = 'Chain could not be linked to a trust anchor.' 14:46:03.610 -> Connection failed 14:46:10.872 -> pm open,type:2 0 14:46:13.540 -> :rcl 14:46:13.540 -> :abort

I tried to replace https with www too but still i get handshake failed from this i guess there is some sort of certificate issue. i have also attached the certificate value i got from my web browser.

i tried connecting to host in all possible ways but still i did not find a solution

https://script.google.com http://script.google.com www.script.google.com

nothing worked for me.i really don't understand where am i lagging. is there any other host name for google sheets?

[image: certificate] https://user-images.githubusercontent.com/56723796/69134877-39fb2800-0ade-11ea-9853-1631ff1366e1.JPG

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/witnessmenow/arduino-sample-api-request/issues/1?email_source=notifications&email_token=AAL5PQXPDTWTC5KLUMAEGI3QUOYH3A5CNFSM4JPAFIDKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEENQPUA#issuecomment-555419600, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAL5PQX4G3SURCBOFMKWQ3TQUOYH3ANCNFSM4JPAFIDA .

vtronicsautomation commented 4 years ago

Try use "script.google.com" On Tue, 19 Nov 2019, 09:42 vtronicsautomation, @.**> wrote: Thank you so much for your reply brain // Just the base of the URL you want to connect to #define TEST_HOST " www.script.google.com" SERIAL MONITOR O/P:* 14:45:56.693 -> SDK:2.2.1(cfd48f3)/Core:2.5.2=20502000/lwIP:STABLE-2_1_2_RELEASE/glue:1.1-7-g82abda3/BearSSL:a143020 14:45:56.693 -> bcn 0 14:45:56.693 -> del if1 14:45:56.693 -> usl 14:45:56.693 -> mode : sta(cc:50:e3:5d:2c:f2) 14:45:56.693 -> add if0 14:45:56.861 -> wifi evt: 8 14:45:56.963 -> Connecting Wifi: GAMING-PC 14:45:57.031 -> ....wifi evt: 2 14:45:59.053 -> ..scandone 14:46:00.861 -> state: 0 -> 2 (b0) 14:46:00.861 -> .state: 2 -> 3 (0) 14:46:00.861 -> state: 3 -> 5 (10) 14:46:00.861 -> add 0 14:46:00.861 -> aid 2 14:46:00.861 -> cnt 14:46:00.928 -> 14:46:00.928 -> connected with GAMING-PC, channel 11 14:46:01.033 -> dhcp client start... 14:46:01.033 -> wifi evt: 0 14:46:01.376 -> ....ip:192.168.1.145,mask:255.255.255.0,gw:192.168.1.100 14:46:02.861 -> wifi evt: 3 14:46:03.369 -> 14:46:03.369 -> WiFi connected 14:46:03.369 -> IP address: 14:46:03.369 -> 192.168.1.145 14:46:03.369 -> [hostByName] request IP for: www.script.google.com 14:46:03.369 -> [hostByName] Host: www.script.google.com IP: 74.125.130.189 14:46:03.369 -> :ref 1 14:46:03.438 -> BSSL:_connectSSL: start connection 14:46:03.438 -> :wr 226 0 14:46:03.438 -> :wrc 226 226 0 14:46:03.506 -> :ack 226 14:46:03.506 -> :rn 536 14:46:03.506 -> :rch 536, 536 14:46:03.506 -> :rch 1072, 536 14:46:03.506 -> :rch 1608, 536 14:46:03.506 -> :rd 5, 2144, 0 14:46:03.506 -> :rdi 536, 5 14:46:03.506 -> :rd 87, 2144, 5 14:46:03.506 -> :rdi 531, 87 14:46:03.506 -> :rd 5, 2144, 92 14:46:03.506 -> :rdi 444, 5 14:46:03.506 -> :rd 2047, 2144, 97 14:46:03.506 -> :rdi 439, 439 14:46:03.506 -> :c 439, 536, 2144 14:46:03.506 -> :rdi 536, 536 14:46:03.506 -> :c 536, 536, 1608 14:46:03.506 -> :rdi 536, 536 14:46:03.506 -> :c 536, 536, 1072 14:46:03.506 -> :rdi 536, 536 14:46:03.548 -> :c0 536, 536 14:46:03.575 -> :rn 536 14:46:03.575 -> :rch 536, 536 14:46:03.575 -> :rch 1072, 2 14:46:03.610 -> :rd 760, 1074, 0 14:46:03.610 -> :rdi 536, 536 14:46:03.610 -> :c 536, 536, 1074 14:46:03.610 -> :rdi 536, 224 14:46:03.610 -> BSSL:insecure_end_chain: Received cert FP doesn't match 14:46:03.610 -> BSSL:_wait_for_handshake: failed 14:46:03.610 -> BSSL:Couldn't connect. Error = 'Chain could not be linked to a trust anchor.' 14:46:03.610 -> Connection failed 14:46:10.872 -> pm open,type:2 0 14:46:13.540 -> :rcl 14:46:13.540 -> :abort I tried to replace https with www too but still i get handshake failed from this i guess there is some sort of certificate issue. i have also attached the certificate value i got from my web browser. i tried connecting to host in all possible ways but still i did not find a solution https://script.google.com http://script.google.com www.script.google.com nothing worked for me.i really don't understand where am i lagging. is there any other host name for google sheets? [image: certificate] https://user-images.githubusercontent.com/56723796/69134877-39fb2800-0ade-11ea-9853-1631ff1366e1.JPG — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#1?email_source=notifications&email_token=AAL5PQXPDTWTC5KLUMAEGI3QUOYH3A5CNFSM4JPAFIDKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEENQPUA#issuecomment-555419600>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAL5PQX4G3SURCBOFMKWQ3TQUOYH3ANCNFSM4JPAFIDA .

I tried "script.google.com" but still i get same error says FP doesn't match , is this really a host name issue or any sort of certificate issues . i have attached certificate screenshot as well as nodeMCU setting schot certificate node_setting

witnessmenow commented 4 years ago

It looks ok to me on a quick look, maybe try commenting out the set fingerprint line and use the set insecure to test everything else is working

On Tue, 19 Nov 2019, 09:53 vtronicsautomation, notifications@github.com wrote:

Try use "script.google.com" … <#m7057245061051504183> On Tue, 19 Nov 2019, 09:42 vtronicsautomation, @.**> wrote: Thank you so much for your reply brain // Just the base of the URL you want to connect to #define TEST_HOST " www.script.google.com" SERIAL MONITOR O/P:* 14:45:56.693 -> SDK:2.2.1(cfd48f3)/Core:2.5.2=20502000/lwIP:STABLE-2_1_2_RELEASE/glue:1.1-7-g82abda3/BearSSL:a143020 14:45:56.693 -> bcn 0 14:45:56.693 -> del if1 14:45:56.693 -> usl 14:45:56.693 -> mode : sta(cc:50:e3:5d:2c:f2) 14:45:56.693 -> add if0 14:45:56.861 -> wifi evt: 8 14:45:56.963 -> Connecting Wifi: GAMING-PC 14:45:57.031 -> ....wifi evt: 2 14:45:59.053 -> ..scandone 14:46:00.861 -> state: 0 -> 2 (b0) 14:46:00.861 -> .state: 2 -> 3 (0) 14:46:00.861 -> state: 3 -> 5 (10) 14:46:00.861 -> add 0 14:46:00.861 -> aid 2 14:46:00.861 -> cnt 14:46:00.928 -> 14:46:00.928 -> connected with GAMING-PC, channel 11 14:46:01.033 -> dhcp client start... 14:46:01.033 -> wifi evt: 0 14:46:01.376 -> ....ip:192.168.1.145,mask:255.255.255.0,gw:192.168.1.100 14:46:02.861 -> wifi evt: 3 14:46:03.369 -> 14:46:03.369 -> WiFi connected 14:46:03.369 -> IP address: 14:46:03.369 -> 192.168.1.145 14:46:03.369 -> [hostByName] request IP for: www.script.google.com 14:46:03.369 -> [hostByName] Host: www.script.google.com IP: 74.125.130.189 14:46:03.369 -> :ref 1 14:46:03.438 -> BSSL:_connectSSL: start connection 14:46:03.438 -> :wr 226 0 14:46:03.438 -> :wrc 226 226 0 14:46:03.506 -> :ack 226 14:46:03.506 -> :rn 536 14:46:03.506 -> :rch 536, 536 14:46:03.506 -> :rch 1072, 536 14:46:03.506 -> :rch 1608, 536 14:46:03.506 -> :rd 5, 2144, 0 14:46:03.506 -> :rdi 536, 5 14:46:03.506 -> :rd 87, 2144, 5 14:46:03.506 -> :rdi 531, 87 14:46:03.506 -> :rd 5, 2144, 92 14:46:03.506 -> :rdi 444, 5 14:46:03.506 -> :rd 2047, 2144, 97 14:46:03.506 -> :rdi 439, 439 14:46:03.506 -> :c 439, 536, 2144 14:46:03.506 -> :rdi 536, 536 14:46:03.506 -> :c 536, 536, 1608 14:46:03.506 -> :rdi 536, 536 14:46:03.506 -> :c 536, 536, 1072 14:46:03.506 -> :rdi 536, 536 14:46:03.548 -> :c0 536, 536 14:46:03.575 -> :rn 536 14:46:03.575 -> :rch 536, 536 14:46:03.575 -> :rch 1072, 2 14:46:03.610 -> :rd 760, 1074, 0 14:46:03.610 -> :rdi 536, 536 14:46:03.610 -> :c 536, 536, 1074 14:46:03.610 -> :rdi 536, 224 14:46:03.610 -> BSSL:insecure_end_chain: Received cert FP doesn't match 14:46:03.610 -> BSSL:_wait_for_handshake: failed 14:46:03.610 -> BSSL:Couldn't connect. Error = 'Chain could not be linked to a trust anchor.' 14:46:03.610 -> Connection failed 14:46:10.872 -> pm open,type:2 0 14:46:13.540 -> :rcl 14:46:13.540 -> :abort I tried to replace https with www too but still i get handshake failed from this i guess there is some sort of certificate issue. i have also attached the certificate value i got from my web browser. i tried connecting to host in all possible ways but still i did not find a solution https://script.google.com http://script.google.com www.script.google.com nothing worked for me.i really don't understand where am i lagging. is there any other host name for google sheets? [image: certificate] https://user-images.githubusercontent.com/56723796/69134877-39fb2800-0ade-11ea-9853-1631ff1366e1.JPG — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#1 https://github.com/witnessmenow/arduino-sample-api-request/issues/1?email_source=notifications&email_token=AAL5PQXPDTWTC5KLUMAEGI3QUOYH3A5CNFSM4JPAFIDKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEENQPUA#issuecomment-555419600>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAL5PQX4G3SURCBOFMKWQ3TQUOYH3ANCNFSM4JPAFIDA .

I tried "script.google.com" but still i get same error says FP doesn't match , is this really a host name issue or any sort of certificate issues . i have attached certificate screenshot as well as nodeMCU setting schot [image: certificate] https://user-images.githubusercontent.com/56723796/69136251-87789480-0ae0-11ea-8d73-c0d989ad50f3.JPG [image: node_setting] https://user-images.githubusercontent.com/56723796/69136252-87789480-0ae0-11ea-928f-80ae7e13d3e1.png

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/witnessmenow/arduino-sample-api-request/issues/1?email_source=notifications&email_token=AAL5PQSOISYFB7LFN7ZNS5DQUOZSJA5CNFSM4JPAFIDKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEENRXOA#issuecomment-555424696, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAL5PQUIBIOGR2IE3HCYCZ3QUOZSJANCNFSM4JPAFIDA .

vtronicsautomation commented 4 years ago

hii brian, i tried commenting set fingerprint line too but im still getting same type of error, on the whole it says certificates expired or not yet yield, thank you for your support .

image

witnessmenow commented 4 years ago

// If you don't need to check the fingerprint // client.setInsecure();

Did you remove the comment from set insecure?

On Tue, 19 Nov 2019, 10:16 vtronicsautomation, notifications@github.com wrote:

tried commenting that too but im still getting same type of error, on the whole it says certificates expired or not yet yield, thank you for your support .

[image: image] https://user-images.githubusercontent.com/56723796/69137774-6b2a2700-0ae3-11ea-8f3d-8fe0b5046a2f.png

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/witnessmenow/arduino-sample-api-request/issues/1?email_source=notifications&email_token=AAL5PQRTBMLFFSOF3H7K6J3QUO4G7A5CNFSM4JPAFIDKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEENUIYI#issuecomment-555435105, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAL5PQRXXB6IZESTOZXAQGDQUO4G7ANCNFSM4JPAFIDA .

vtronicsautomation commented 4 years ago

hii, i tried in either ways

`// If you don't need to check the fingerprint // client.setInsecure();

// If you want to check the fingerprint client.setFingerprint(TEST_HOST_FINGERPRINT); // If you don't need to check the fingerprint client.setInsecure();

// If you want to check the fingerprint //client.setFingerprint(TEST_HOST_FINGERPRINT); `

in both modes error remains same nothing seems to be changed.

the actual host name i used was "script.google.com " with which the host was not even got connected but after doing lot of internet research i found the actual host name to be "script.googleusercontent.com" , so once i changed the host name i got it connected but still returned bssl certificate error.

agoes77 commented 4 years ago

hello guys, I'm having a problem, where I can't connect to script.google.com. The error I experienced was Error with request. Response status code: 500.

// Use HTTPSRedirect class to create a new TLS connection client = new HTTPSRedirect(httpsPort); client->setInsecure(); client->setPrintResponseBody(true); client->setContentTypeHeader("application/json"); Serial.print("Connecting to "); Serial.println(host);

and display on the serial monitor Connecting to wifi: moshpit . WiFi connected IP address: 192.168.43.6 Connecting to script.google.com Error with request. Response status code: 500 Error with request. Response status code: 500 Arus= 56.55 GET url :/macros/s/AKfycbwFCz17c-MaUWxj7WRTthz8gZXkRwktU-y0DiDuVsk/dev?Arus=56.55 Error with request. Response status code: 0 Arus= 13.32 GET url :/macros/s/AKfycbwFCz17c-MaUWxj7WRTthz8gZXkRwktU-y0DiDuVsk/dev?Arus=13.32 Error with request. Response status code: 500

I am sorry, my English is not good. Please help me thank you

jaymedavis commented 2 years ago

I really hope this might help you - I have been struggling all day with a similar problem, which I haven't fully solved either. Good luck either way! https://github.com/jbuszkie/HTTPSRedirect#sec-iv-working-example-using-google-docs