help, I get INVALID AUTH TOKEN

hello this is my first time with nodemcu esp8266
I saw other forums but with none I can solve it
excuse bad english
Thank you very much in advance

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
#include <DHT.h>

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

// WIFI
// Set password to "" for open networks.
char ssid[] = "A 51";
char pass[] = "";


/* DHT11*/

#define DHTTYPE DHT11 
#define DHTPIN D8
#define DHTVCC D2
#define soilMoisterPin A0
#define soilMoisterVcc D6
#define ptrVcc D5
#define relay_pump D4
#define relay_leds D7

DHT dht(DHTPIN, DHTTYPE);


//Define variables
float hum = 0;
float temp = 0;
int soilMoister = 0;
int lum =0;


//define treshold for variables

int seuil_lum = 200;
int seuil_moisture = 300;
int time_pump_ON = 1000; //
bool leds_ON = false;

//declaration of the timer
SimpleTimer timer;

//declare the widgets 

WidgetLED led1(V4);
WidgetLED led2(V5);
void setup()
{
  //Soil moisture
  pinMode(soilMoisterVcc,OUTPUT);
  digitalWrite(soilMoisterVcc,LOW);
  //DHT
  pinMode(DHTVCC,OUTPUT);
  digitalWrite(DHTVCC,LOW);
  pinMode(DHTPIN,INPUT);
  //LDR
  pinMode(ptrVcc,OUTPUT);
  digitalWrite(ptrVcc,LOW);
  //Relays
  pinMode(relay_pump, OUTPUT);
  pinMode(relay_leds, OUTPUT);
  
  digitalWrite(relay_pump,LOW); 
  digitalWrite(relay_leds,HIGH);//If the relay is ON whenever it should be OFF, Then put LOW here and inverse the states in the analyses functions
  
  Serial.begin(115200); // See the connection status in Serial Monitor
   delay(10);
   //BLYNK
  Blynk.begin(auth, ssid, pass); // Connexion to Blynk 
  dht.begin();

  led1.on();
  led2.on();
  // Setup a function to be called every intervals
  timer.setInterval(12000L,getData);

}
void getData()
 {
  Serial.println("analysis started");
  getDhtData();
  getSoilMoisterData();
  ProcessingLights();
  Processing_Moisture();
 }
void loop()
{
  Blynk.run(); // Initiates Blynk
  timer.run(); // Initiates SimpleTimer
}
void getDhtData(void)
{
  digitalWrite (DHTVCC,HIGH);
  delay(500);
  float tempIni = temp;
  float humIni = hum;
  temp = dht.readTemperature();
  hum = dht.readHumidity();
  if (isnan(hum) || isnan(temp))   // Check if any reads failed and exit early (to try again).
  {
    Serial.println("Failed to read from DHT sensor!");
    temp = tempIni;
    hum = humIni;
    return;
  }
  Serial.println("Temperature :");
  Serial.println(temp);
  Serial.println("Humidity :");
  Serial.println(hum);
  Blynk.virtualWrite(V2, hum);
  Blynk.virtualWrite(V0, temp);
  
}
//for the soil moisture and from my experience :
//650 wet
//1024 most dry

void getSoilMoisterData(void)
{
  
  digitalWrite (DHTVCC,LOW);
  digitalWrite (soilMoisterVcc, HIGH);
  delay (500);  
  soilMoister = analogRead(soilMoisterPin);
  soilMoister = (soilMoister *100)/1024;
  Serial.println("Soil moisture measured:");
  Serial.println(soilMoister);
  soilMoister = (soilMoister *100)/1024;
 // soilMoister = map(soilMoister, 380, 0, 0, 100); 
  Blynk.virtualWrite(V3, soilMoister);
  digitalWrite (soilMoisterVcc, LOW);  
  delay(500);  
  digitalWrite (ptrVcc,HIGH);
  delay(500);  
  lum = analogRead(soilMoisterPin);
  lum = ( lum *100 )/1024 ;
  Serial.println("Light measured:");
  Serial.println(lum);
  Blynk.virtualWrite(V1,lum);
  digitalWrite(ptrVcc,LOW);  
}
//funtion processing the data coming from the LDR, turning OFF and ON the artificial light system if needed.
void ProcessingLights()
{
  if(lum < seuil_lum && (leds_ON == false ))
  {
    Serial.println("LEDs ON");
    digitalWrite(relay_leds,LOW);
    Blynk.setProperty(V5, "color", "#00FF2E");
  }
  else if(lum < seuil_lum && (leds_ON == true))
  {
    Serial.println("LEDs already ON");
  }
  else
  {
    Serial.println("LEDs OFF");
    digitalWrite(relay_leds,HIGH);
    Blynk.setProperty(V5, "color", "#FF0000");
  }
  delay(200);
}

//function running the processing of Soil moisture collected Data, and triggering the water pump if needed
void Processing_Moisture()
{
  if(soilMoister < seuil_moisture)
  {
    Serial.println("PUMP OFF");
     digitalWrite(relay_pump,LOW);
     Blynk.setProperty(V4, "color", "#FF0000");
  }
  else
  {
    Serial.println("PUMP ON");
    digitalWrite(relay_pump,HIGH);
    delay(time_pump_ON);
    digitalWrite(relay_pump,LOW);
    Blynk.setProperty(V4, "color", "#00FF2E");
  }  
}

I noticed this problem today also, so I think you may have the same issue.

I replaced Blynk.begin(auth, ssid, pass); with Blynk.begin(auth, ssid, pass, IPAddress(45,55,96,146), 80); and then it worked for me.

The IP address will likely depend on where you are, but you can confirm by pinging blynk-cloud.com and using the ip address from there. For me that was 45.55.96.146

Hope it helps

@fabrivignati Your project is also located on the New York server, IP address 45.55.96.146

If @Amsok’s solution works for you then please let me know, as this may be a DNS or sever routing issue that needs to be flagged-up with the guys at Blynk.

Pete.

excuse my ignorance but in which part of the sketch is placed “Blynk.begin (auth, ssid, pass, IPAddress (45,55,96,146), 80)”
I never did a project with the internet

You replace this line in your existing sketch.

Pete.

Thank you very much, now the sketch works perfect

@Dmitriy I realise you guys are busy, but it seems that there may be an issue with the system that re-directs connections to the correct cloud server, to overcome the Geo DNS issue.
Both @Amsok and @fabrivignati have received “invalid Auth token” messages when attempting to connect using blynk.cloud.com, but explicitly specifying the IP address of the New York server overcomes the problem.

I’m guessing that the connection is hitting one of the other servers but isn’t being redirected.

Pete.

“invalid auth token” issue is fixed in v1.0.0-beta.3.
Note that using beta is not recommended for general public, as it is intended to be used only with the upgraded Blynk Cloud (however, most things will work as expected).