Skip to content

WPA2-Enterprise support on ESP32  #2747

@ghost

Description

Hi,
I am trying to use WLED in a WPA2-Enterprise network. I've found the following code from @garyd9 . But I don't understand where to insert the code.
I am not really good in programming and I am trying to learn it through the internet. I can edit the WLED-code but I don't know where to insert it.
It would be cool, if anyone can help me.

Thanks

Comment by @garyd9 :

I'll just leave this little block of code I inserted in initConnection() here (mostly taken from various google search results)... Oh, and it does work. On my particular network, my username must be "domain\user" instead of just "user", but it does work fine on PEAP/MSCHAPv2 (coming from an ESP32 device)

(requires "esp_wpa2.h" to be included to get at the WPA2 type and macro)

  const char *username = "MYDOMAIN\\username";
  const char *password = "mypassword";

  WiFi.disconnect(true);
  WiFi.mode(WIFI_STA);  // didn't work without this.  odd.
  esp_wifi_sta_wpa2_ent_set_username((uint8_t *)username, strlen(username));
  esp_wifi_sta_wpa2_ent_set_password((uint8_t *)password, strlen(password));
  esp_wpa2_config_t config = WPA2_CONFIG_INIT_DEFAULT();
  esp_err_t code = esp_wifi_sta_wpa2_ent_enable(&config);
  Serial.print ("enable response code: ");
  Serial.println(code);
  const char *ssid = clientSSID;
  Serial.print("wifi Begin connection to: "); Serial.println(ssid);
  WiFi.begin(ssid);

To use this properly, the HTTP UI would need to prompt for an additional piece of info: a username. I just hard-coded everything to try it out. (I'm still exploring this esp32 dev board. it's fun.)

Originally posted by @garyd9 in #1001 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions