Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is this library still working? Or has google changed something #87

Open
baykey opened this issue Jan 22, 2020 · 4 comments
Open

Is this library still working? Or has google changed something #87

baykey opened this issue Jan 22, 2020 · 4 comments

Comments

@baykey
Copy link

baykey commented Jan 22, 2020

I'm trying to connect to script.google.com and I keep getting 0 as return value on int retval = client.connect("script.google.com", 443);

So I'm wondering if the library is still up, or if google changed something to its security.. (I've had several other examples fail because google changed something..

@github-actions
Copy link

Welcome to HTTPSRedirect! Please provide enough info to debug the issue.

@SebastianGrans
Copy link

SebastianGrans commented Feb 16, 2020

@baykey: It's still working for me.
Here's an example:

#include <ESP8266WiFi.h>
#include "HTTPSRedirect.h"

const char* ssid = "<wifi ssid>";
const char* password = "<wifi password>";

const char* host = "script.google.com";
# A google sheets sheet with same script as in the repo GoogleScript.gs attached to it.
# Remember to publish as the README describes. 
const char *GScriptId = "<your gscript id>";
const int httpsPort = 443;

// Write to Google Spreadsheet
String url = String("/macros/s/") + GScriptId + "/exec?value=";
String url2 = String("/macros/s/") + GScriptId + "/exec?";

String payload_base =  "{\"command\": \"appendRow\", \
                    \"sheet_name\": \"<insert your sheet name here>\", \
                    \"values\": ";
                    
String payload = "";

HTTPSRedirect* client = nullptr;

void setup() {
  Serial.begin(9600);
  Serial.flush();

  Serial.println();
  Serial.print("Connecting to wifi: ");
  Serial.println(ssid);
  // flush() is needed to print the above (connecting...) message reliably,
  // in case the wireless connection doesn't go through
  Serial.flush();

  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());
}

void loop() {
 Serial.println("Sending");
 bool ret = sendToSpreadsheet(1234);
 Serial.println(ret);
 delay(2000);
}```

@siddhc
Copy link

siddhc commented Mar 15, 2020

In Arduino, the ESP8266 library should be Ver 2.5.2. This is what made it work for me. I have not tested on higher versions (2.6.3 is available as on today).

@StorageB
Copy link

StorageB commented May 4, 2021

The library is still working fine. However, Google did make changes to their Script Editor. If you make changes to your Google Script, you must make a new deployment and update your ESP8266 code with the new Deployment ID (this was previously called the Script ID) in this line of code:
const char *GScriptId = "AKfycbzYw5G-oxvnwHpAJfDsS0PWNrO0KTBMiCW78lHUcEO6ZnFHvSw";

This was previously not the case as you could make a new deployment and not have to update the ESP8266 code. The Deployment ID is given to you when you create a new deployment, or can be found by going to Deploy > Manage Deployment in the Script Editor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants