How can I connect to Wifi with esp32 when network has user input

Hello, I have a Wemos Lolin32 lite board which I want to use to connect to wifi and access sensor data reading over wifi/arduino iot. The network I need to use has username and password , how can I account for the username when connecting the board to the wifi?

This is the code I am using




#include "WiFi.h"
 
const char* ssid = "Company";
const char* user= "user1";
const char* password =  "password1";
 
void setup() {
 
  Serial.begin(115200);
 
  WiFi.begin(ssid, password);
 
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.println("Connecting to WiFi..");
  }
 
  Serial.println("Connected to the WiFi network");
 

 


pinMode(34, INPUT);
  pinMode(13, OUTPUT);
  pinMode(12, OUTPUT);
}

void loop() {
 int threshold = 300;
 float vibration = analogRead(34);
 Serial.println(vibration*100);
 delay(5);
}

Does anyone know what I should do?

1 Like

Hi, here you may find some answers regrading the user-defined ssid and password for ESP modules. :User defined SSID and PASSWORD ESP8266 - #3 by gauravntpl

Is it one where, when you connect to the WiFi with a browser, you get a web dialog where you have to enter username and password? Connect with a browser and see if you are redirected to a particular web page. In your ESP32 sketch, GET that web page and send a POST request to provide values for the Username and Password form fields. That should then allow access to the rest of the network.

1 Like

No, it is input directly when selecting the network, instead of just password I also have to write my user name

Or a cheap&ugly® solution could be to connect to the network with your phone and use it as a hotspot.
Maybe...

Is this on Microsoft Windows?

Yes. Actually now that I am looking through all the networks, there is one for "Guests" that directs to a browser website to input username and password. I am trying to use the get and post functions by reading the html source code but have to admit I am kind of lost even reading the documentation

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.