espressif / arduino-esp32

Arduino core for the ESP32
GNU Lesser General Public License v2.1
13.26k stars 7.34k forks source link

wifi.h, WifiServer authentication example for website? (Webserver authentication example is not compatible) #8703

Open dsyleixa opened 11 months ago

dsyleixa commented 11 months ago

Related area

ESP32

Hardware specification

ESP32 Adafruit Feather

Is your feature request related to a problem?

based on https://github.com/espressif/arduino-esp32/blob/master/libraries/WiFi/examples/SimpleWiFiServer/SimpleWiFiServer.ino

I would need an authentication example for wifi.h (not webserver.h)

Describe the solution you'd like

based on https://github.com/espressif/arduino-esp32/blob/master/libraries/WiFi/examples/SimpleWiFiServer/SimpleWiFiServer.ino I would need an authentification example for wifi.h ! without ! webserver.h The only authentication I found is unfortunately for only webserver but which is not suitable.

Authenification by WebServer example
https://github.com/espressif/arduino-esp32/blob/master/libraries/WebServer/examples/HttpBasicAuth/HttpBasicAuth.ino is not compatible for Wifi.h / wifiserver (can't figure it out)

my current solution for esp8266Wifi.h

  if (!authorized) {
      handleLogInRequested();
      delay(100);
   }

   if (authorized) {
      handleWebsite();
      delay(10);
   }
 }

works fine for esp8266 but fails for esp32, can't port it correctly, none of the HTML websites are displayed, so a working wifi.h authentication example is needed.

Describe alternatives you've considered

I tried code which works for esp8266 but that is not compatible: using this esp8266 code for esp32 then none of the HTML websites are displayed, so a working wifi.h authentication example is needed.

Additional context

No response

I have checked existing list of Feature requests and the Contribution Guide

lbernstone commented 11 months ago

It is open source code. You can see what it is doing. Nobody owes you an example for something a library does. https://github.com/espressif/arduino-esp32/blob/master/libraries/WebServer/src/WebServer.cpp#L238-L253

dsyleixa commented 11 months ago

your example code is from the WEBserver class lib, but as stated: an example for WIFIserver / WIFIclient is needed, suitable for the SimpleWiFiServer.ino, NOT WEBserver!

Also, I would have no idea what all the letters in the webserver class method mean and do at all.

In addition, the Arduino philosophy lives from the tons of simple, understandable and practical example codes supplied, and finally these are precisely the reasons for the legendary success of Arduino.