BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

I want to add auth to the setup menu. This code only supports username and password

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
#include <ESP8266WebServer.h>
#include <DNSServer.h>
#include <WiFiManager.h>
#include <Ticker.h>
Ticker ticker;


char auth[] = "b95VF34kHBcaUV75AhPGoUU_QYjShn8c";       // You should get Auth Token in the Blynk App.

#define TRIGGER_PIN 0     // Button     Reset Network     ( Pin D3 )
#define LED_PIN 2         // LED        connection status ( Pin D4 )

SimpleTimer timer;






void tick()
{
  int state = digitalRead(LED_PIN);
  digitalWrite(LED_PIN, !state);
}
void configModeCallback (WiFiManager *myWiFiManager) {
  ticker.attach(0.2, tick);
}





void setup()
{
  Serial.begin(9600); 

  pinMode(TRIGGER_PIN, INPUT);
  pinMode(LED_PIN, OUTPUT);
  
  WiFiManager wifiManager;
  ticker.attach(0.6, tick);
  wifiManager.setAPCallback(configModeCallback);
  if (!wifiManager.autoConnect("آلترا سمارت")) {                          //    your ap name
    ESP.reset();
    delay(1000);
  }
ticker.detach();
digitalWrite(LED_PIN, HIGH);



Blynk.config(auth);

}

void loop()
{

  Blynk.run(); 
  timer.run();
  
  int count = 0;
  Blynk.run();

  while(digitalRead(TRIGGER_PIN) == LOW) {
    delay(100);
    count++;
    if(count > 30) {
  
      WiFi.disconnect();
      digitalWrite(LED_PIN, LOW);
      delay(1000);
      count = 0;
      digitalWrite(LED_PIN, HIGH);
      delay(100);
      ESP.reset();
      delay(1000);
    }
  }
}

Please edit your post to add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```

Pete.

1 Like

Please excuse me but I don’t know how to do it. My language is not English. I have difficulty dealing with the forum

Mr. Pete I searched at length for a way to add auth to the WiFi Manager page and I couldn’t make it

Do you know how to copy and paste?
Edit your post using the pencil icon at the bottom of your first post and paste the triple backticks from my post to a blank line at the beginning and end of your code.

Pete.

I did it

You seem to be missing quite a lot of important code that is needed to make WiFiManager work, even for storing SSID and password.

I’d suggest that you take a look at this:

Pete.

It’s useless you’ve tried

My code works fine but lacks the auth add in the WiFi manager page

Есть вариант для Blynk. Видео на русском языке.

You will need to reset the settings in case the router password is changed
Please help by adding this feature

@wasemooo4, your replies don’t seem to make much sense, and comments like this come across as being quite rude:

I appreciate that English may not be your first language, but I think you may need to take more effort with your translation, or make your posts in your own language.

Pete.

Looks like you misunderstood my sorry if my response was rude