Closed
Description
Hardware:
Board: Heltec WiFi Kit 32
Core Installation version: 1.0.4
IDE name: Arduino IDE 1.8.10
Flash Frequency: 80MHz
PSRAM enabled: No
Upload Speed: 115200
Computer OS: iOS 13 on iPhone
Description:
HTTP authentication fails when using DIGEST_AUTH with WebServer::authenticate
from iOS devices. It occurs in any of Safari, Firefox, and Chrome.
This could be an iOS13 issue, but the ESP8266 arduino core has dealt with a similar issue.
esp8266/Arduino#4717
How does the esp32 arduino-core will deal with this problem?
Sketch:
The below sketch as a quote from the HttpAdvancedAuth.ino.
#include <WiFi.h>
#include <ESPmDNS.h>
#include <ArduinoOTA.h>
#include <WebServer.h>
const char* ssid = "........";
const char* password = "........";
WebServer server(80);
const char* www_username = "admin";
const char* www_password = "esp32";
const char* www_realm = "Custom Auth Realm";
String authFailResponse = "Authentication Failed";
void setup() {
Serial.begin(115200);
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
if (WiFi.waitForConnectResult() != WL_CONNECTED) {
Serial.println("WiFi Connect Failed! Rebooting...");
delay(1000);
ESP.restart();
}
ArduinoOTA.begin();
server.on("/", []() {
if (!server.authenticate(www_username, www_password))
{
return server.requestAuthentication(DIGEST_AUTH, www_realm, authFailResponse);
}
server.send(200, "text/plain", "Login OK");
});
server.begin();
Serial.print("Open http://");
Serial.print(WiFi.localIP());
Serial.println("/ in your browser to see it working");
}
void loop() {
ArduinoOTA.handle();
server.handleClient();
}
Metadata
Metadata
Assignees
Labels
No labels