From 63839ab84de620377fff1ab6b52922a448e606e8 Mon Sep 17 00:00:00 2001 From: Scott Baker Date: Thu, 9 Nov 2023 10:12:04 -0800 Subject: [PATCH] Add an auth example --- examples/Authentication/Authenticate.ino | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 examples/Authentication/Authenticate.ino diff --git a/examples/Authentication/Authenticate.ino b/examples/Authentication/Authenticate.ino new file mode 100644 index 0000000..81399dc --- /dev/null +++ b/examples/Authentication/Authenticate.ino @@ -0,0 +1,24 @@ +const char* host = "ESP-OTA"; // Used for MDNS resolution +const char* ssid = "ssid"; +const char* password = "password"; + +#include + +// the setup function runs once when you press reset or power the board +void setup() { + Serial.begin(115200); + + init_wifi(ssid, password, host); + + // If you call useAuth() in your setup function WebOTA will use + // HTTP digest authentication to request credentials from the user + // before allowing uploads + webota.useAuth("username", "password"); +} + +// the loop function runs over and over again forever +void loop() { + // Do other stuff + + webota.handle(); +}