Help me please

I just copied one sample of coding to control led from blynk web.

#define BLYNK_TEMPLATE_ID "x"
#define BLYNK_DEVICE_NAME "x"
#define BLYNK_AUTH_TOKEN "x"
char auth[] = BLYNK_AUTH_TOKEN;       // You should get Auth Token in the Blynk App.
char ssid[] = "x";                    // Your Wi-Fi Credentials
char pass[] = "x";
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
int pin = 4;

void setup() {  
  pinMode(pin, OUTPUT); 
  pinMode(pin, HIGH);
  Serial.begin(115200);
  delay(10);
  Serial.print("Connecting to ");
  Serial.println(ssid);
  WiFi.begin(ssid, pass);
  int wifi_ctr = 0;
  while (WiFi.status() != WL_CONNECTED) {
  delay(500);
  Serial.print(".");
  }
  Serial.println("WiFi connected");  
  Blynk.begin("Your auth. Token", ssid, pass);
}
void loop(){
    Blynk.run();
}

I connect led to esp32 board (GND and pin G4), serial monitor show like this

Connecting to x
[1150] Connected to WiFi
[1150] IP: 192.168.43.16
[1150] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v1.0.1 on ESP32

[1160] Connecting to blynk.cloud:80
[1865] Invalid auth token

help me please, what to do

still same sir.

#define BLYNK_TEMPLATE_ID "x"
#define BLYNK_DEVICE_NAME "x"
// #define BLYNK_AUTH_TOKEN "x"
#define BLYNK_PRINT Serial

#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>

char auth[] = "x";       // You should get Auth Token in the Blynk App.
char ssid[] = "x";                    // Your Wi-Fi Credentials
char pass[] = "x";


int pin = 4;

void setup() {  
  pinMode(pin, OUTPUT); 
  pinMode(pin, HIGH);
  Serial.begin(115200);
  delay(10);
  Serial.print("Connecting to ");
  Serial.println(ssid);
  WiFi.begin(ssid, pass);
  int wifi_ctr = 0;
  while (WiFi.status() != WL_CONNECTED) {
  delay(500);
  Serial.print(".");
  }
  Serial.println("WiFi connected");  
  Blynk.begin("Your auth. Token", ssid, pass);
}
void loop(){
    Blynk.run();
}

invalid auth token

Is this a sample file from within the Arduino IDE? If not, try loading one from the IDE itself.

no, this open source file from website. may I know which code should I choose to control led with blynk app

Change this to:

Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);

Pete.

Can you provide a link to the location where you found this code please?
It’s quite strange, because it’s attempting to create a WiFi connection, then calling Blynk.begin(). This creates its own WiFi connection, so there is no need for the WiFi connection code.

Pete.

I think the example in the IDE is called BLYNKBlink or something close to that. You have to install the Blynk library

https://iotdesignpro.com/projects/iot-controlled-led-using-esp32-with-blynk-app

this one

This implies that you’ve downloaded it from the Blynk website. The link you provided is a 3rd party website. In addition, the sketch is written for Blynk a legacy not Blynk IoT
Judging by the standard of coding, I’d steer clear of that site and stick with the Blynk examples.

If you want working examples then open the IDE and go to Examples > Blynk and choose the examples from there.

Also, you’ve created three topics in the past 13 hours which all appear to be connected to the same thing that you’re trying to achieve.
Please keep your discussions in one place, and focus on trying to provide as much useful information as possible, and give full and unambiguous answers when people ask questions and provide feedback.

Did making the change I suggested solve your Invalid Auth Token issue?

Pete.

ya solved already, thanks