Blynk Connection to WPA2 EAP Networks

I am using Blynk in combination with an Arduino Mega and an ESP8266. After some tests, it was rather easy to get connected to my home network, being secured with WPA2 PSK. The problem is, this setup should also work with the university WLAN, being an WPA2 EAP network. The ESP8266 supports this since SDK 1.5, but Blynk only works stable with SDK 1.0 v22 as far as I know. So, does anyone know how to connect to an EAP network with Blynk? Doesn’t have to be with an ESP8266, but it would be good if it would be with that module.

Thanks in advance!

Can you send us some code that works on ESP8266 and your network (without Blynk)?

Hi vhymanskyy,
I don’t know if the original poster sent you code that works without blynk, but I can. This code works with the Blynk stuff commented out as shown, but it crashes with a <<<stack<<< with it.

   #include <Arduino.h>
    #include <ESP8266WiFi.h>

      Download latest Blynk library here:

      Blynk is a platform with iOS and Android apps to control
      Arduino, Raspberry Pi and the likes over the Internet.
      You can easily build graphic interfaces for all your
      projects by simply dragging and dropping widgets.

        Downloads, docs, tutorials:
        Sketch generator: 
        Blynk community:  
        Follow us:        

      Blynk library is licensed under MIT license
      This example code is in public domain.


      You’ll need:
       - Blynk App (download from AppStore or Google Play)
       - ESP8266 board
       - Decide how to connect to Blynk
         (USB, Ethernet, Wi-Fi, Bluetooth, ...)

      There is a bunch of great example sketches included to show you how to get
      started. Think of them as LEGO bricks  and combine them as you wish.
      For example, take the Ethernet Shield sketch and combine it with the
      Servo example, or choose a USB sketch and add a code from SendData

    /* Comment this out to disable prints and save space */
    //#define BLYNK_PRINT Serial

    //#include <BlynkSimpleEsp8266_SSL.h>
    extern "C" {
    #include "user_interface.h"
    #include "wpa2_enterprise.h"

    // You should get Auth Token in the Blynk App.
    // Go to the Project Settings (nut icon).
    char auth[] = "my_auth_token";

    // SSID to connect to
    static const char* ssid = "my_ssid";
    // Username for authentification
    static const char* username = "my_userid";
    // Password for authentication
    static const char* password = "my_passwd";

    void setup() {
      // put your setup code here, to run once:
      // Setting ESP into STATION mode only (no AP mode or dual mode)
      struct station_config wifi_config;
      memset(&wifi_config, 0, sizeof(wifi_config));
      strcpy((char*)wifi_config.ssid, ssid);
      wifi_station_set_enterprise_identity((uint8*)username, strlen(username));
      wifi_station_set_enterprise_username((uint8*)username, strlen(username));
      wifi_station_set_enterprise_password((uint8*)password, strlen(password));
      //wifi_station_connect(); // Commented out with blynk.
      //Blynk.begin(auth, ssid, password);
      // You can also specify server:
      //Blynk.begin(auth, ssid, pass, "", 8442);
      //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8442);
      // Wait for connection AND IP address from DHCP
      Serial.println("Waiting for connection and IP Address from DHCP");
      while (WiFi.status() != WL_CONNECTED) {

      Serial.println("WiFi connected");
      Serial.println("IP address: ");

    void loop()
      Serial.println("In main loop...");
      // You can inject your own code or combine it with other sketches.
      // Check other examples on how to communicate with Blynk. Remember
      // to avoid delay() function!

You obviously have to include your ssid, username and password, and have a WPA2 Enterprise network. Ours is using PEAP.



Hi guys…
Is there any news on having WPA2 EAP for blynk @vshymanskyy?

1 Like

This is a very old topic… Now we can use Blynk.config() as that will allow you to use whatever WiFi setup you need, prior to connecting to Blynk’s server.

FYI, no need to tag a developer that is already in the topic.

Hi @Gunner , i need help on esp32 with wpa2 peap enterprise wifi connect to the blynk. I manage to connect wifi with my esp32 module but it does not work for blynk web application.

Same answers as previously - this is a very old topic, you’d be better starting a new one.

Post your code that DOES work with this network, and your Blynk code that doesn’t work.

Don’t forget to include answers to all of the questions that you are asked when you create a new “Need help with my project” topic, take note of the information about how to correctly format your code when you post it, apply the same formatting when you post your serial monitor output (which will be useful in this situation. Don’t post screenshots of code or serial output.
Be clear about whether you are using Blynk Legacy or Blynk IoT.

BTW, @Gunner isn’t a regular on this forum anymore, I’m probably the 2nd best alternative.

In the meantime, I’m closing this 6 year old topic.