mirror of
https://github.com/scottchiefbaker/ESP-WebOTA.git
synced 2024-08-30 18:12:33 +00:00
Add an auth example
This commit is contained in:
parent
9fbd3e6c38
commit
63839ab84d
24
examples/Authentication/Authenticate.ino
Normal file
24
examples/Authentication/Authenticate.ino
Normal file
@ -0,0 +1,24 @@
|
||||
const char* host = "ESP-OTA"; // Used for MDNS resolution
|
||||
const char* ssid = "ssid";
|
||||
const char* password = "password";
|
||||
|
||||
#include <WebOTA.h>
|
||||
|
||||
// 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();
|
||||
}
|
Loading…
Reference in New Issue
Block a user