Looking for some help in implementing a version of this project. I'm using an ESP8266 as a webserver for the simple page to generate a code for OAuth to approve the device and generate a Refresh Token and Access Token.
Everything works until I get to the actual point of connecting with Google servers. I'm using <WiFiClientSecure.h> but this always fails and I don't know why.
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to WiFi..");
}
WiFiClientSecure client;
if(!client.connect("https://accounts.google.com/o/oauth2/v2/auth", 443)){
Serial.println(F("Connection to google server failed"));
} else{
Serial.println("connected to google");
...
I have seen examples using client.connect, httpsClient.connect, and client_tcp.connect. none of those work. I have also tried all these connection methods with all the different URLs in the documentation given the various methods/devices including
- https://oauth2.googleapis.com/device/code
- https://accounts.google.com/o/oauth2/v2/auth
- script.google.com
How do I connect an ESP to Google OAuth? Do I need another library for a an https connection? Once I connect, do I need a certificate (google documentation doesn't indicate a certificate but not sure if that's just part of an https connection)?