ESP8266 How to connect with WPA2 network?

Hi guys!

Basically I have an ESP8266 and want to connect to a WPA2 network (ssid, username, password). I found a simple program from openhomeautomation.net to set up how to connect to a WPA network (ssid, password). I have look around and cannot find any solution because the Wifi.begin() doesn't have the username part in it. Any solution for this?

Thank you.

// Import required libraries
#include "ESP8266WiFi.h"

// WiFi parameters
const char* ssid = "your_wifi_name";
const char* password = "your_wifi_password";

void setup(void)
{ 
// Start Serial
Serial.begin(115200);

// Connect to WiFi
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");

// Print the IP address
Serial.println(WiFi.localIP());

}

void loop() {

}

const char* ssid = "your_wifi_name"; // replace your_wifi_name with WiFi network name
const char* password = "your_wifi_password"; // and password

What do you mean with "username".
The snippet only connects to the home WiFi network. That doesn't have a username.
Leo..

If you are on a school campus or large corporate office, you may be running into WPA2 Enterprise. Google reveals other ESP8266 users are struggling with this. You might have a talk with an IT support droid about how to handle this for embedded devices. WPA2 Enterprise adds an additional user authentication requirement after connecting to the AP.

Wawa:
What do you mean with "username".
The snippet only connects to the home WiFi network. That doesn't have a username.
Leo..

There some WiFi that requires username and password. I am require to connect to my school's WiFi which has SSID, username, and password to connect normally to the WiFi. Thanks for replying though.

gdsports:
If you are on a school campus or large corporate office, you may be running into WPA2 Enterprise. Google reveals other ESP8266 users are struggling with this. You might have a talk with an IT support droid about how to handle this for embedded devices. WPA2 Enterprise adds an additional user authentication requirement after connecting to the AP.

First I didn't know the whole thing is called WPA2 Enterprise and second yes I am on a school campus for a school project so I don't think talking to an IT support is an option. Thank you though.

I have the similar problem.

I want to use the device on campus. As usual, we need to click on the wifi name (the same location with the ssid), and then input the username and password.

In this condition, how could I connect the wifi for the device?

Best,

As has been explained, the username and password requirement is related to an additional security layer which is provided in WPA2 Enterprise but not WPA2 Personal. WPA2 Enterprise integrates a number of additional user authentication protocols to to allow WiFi devices to authenticate into organisational networks. It would be essential to determine which authentication protocol is being used. Support on the ESP8266 for WAP Enterprise would appear to be in its infancy.

Further discussion of this topic can be found here: