Connecting an ESP32 to a WPA2 Enterprise WiFi requires a bit more configuration than other more common WiFi protocols like WPA PSK or WPA2 PSK. The code below has been tested on NUS_STU, which is a WPA2 Enterprise access point with PEAP, no certificate, and MSCHAPV2. #include "esp_wpa2.h" #include <WiFi.h> #include <HTTPClient.h> #define EAP_IDENTITY "e1234567a" #define EAP_PASSWORD "nusnet-pswd" const char *ssid = "NUS_STU"; void setup() { Serial.begin(115200); delay(10); Serial.println(); Serial.println(ssid); WiFi.disconnect(true); WiFi.mode(WIFI_STA); esp_wifi_sta_wpa2_ent_set_identity((uint8_t *)EAP_IDENTITY, strlen(EAP_IDENTITY)); esp_wifi_sta_wpa2_ent_set_username((uint8_t *)EAP_IDENTITY, strlen(EAP_IDENTITY)); esp_wifi_sta_wpa2_ent_set_password((uint8_t *)EAP_PASSWORD, strlen(EAP_PASSWORD)); esp_wpa2_config_t config = WPA2_CONFIG_INIT_DEFAULT(); esp_wifi_sta_wpa2_ent_enable(&config); Serial.println("MAC address: "); Serial.println(WiFi.macAddress()); WiFi.begin(ssid); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); } Serial.println(""); Serial.println("IP address: "); Serial.println(WiFi.localIP()); HTTPClient http; String serverPath = "http://ip-api.com/line"; http.begin(serverPath.c_str()); int httpResponseCode = http.GET(); if (httpResponseCode > 0) { Serial.print("HTTP Response code: "); Serial.println(httpResponseCode); String payload = http.getString(); Serial.println(payload); } else { Serial.print("Error code: "); Serial.println(httpResponseCode); } http.end(); String payload = http.getString(); Serial.println(payload); } void loop() {}