blynkkk / blynk_Issues

6 stars 6 forks source link

Invalid Auth Token issue on ESP8266 #226

Open Atomix2402 opened 1 year ago

Atomix2402 commented 1 year ago

Hey guys I need help here, I'm new to IoT and Blynk and for mini projects i was doing this Plant watering system using nodemcu and blynk app. So when i was running the code in the ide. in the serial monitor i got like this

[6303] Connected to WiFi [6303] IP: xxx.xx.xx.xx [6303]


/ )/ / _ / /_ / / / // / \/ '/ ///_, /////_\ /___/ v1.1.0 on ESP8266

StandWithUkraine https://bit.ly/swua

[6429] Connecting to blynk-cloud.com:80 [7600] Invalid auth token [24428] Connecting to blynk-cloud.com:80 [24972] Invalid auth token [42428] Connecting to blynk-cloud.com:80 [42996] Invalid auth token [60428] Connecting to blynk-cloud.com:80 [61016] Invalid auth token [78428] Connecting to blynk-cloud.com:80 [78833] Invalid auth token

even though i made the code for the newer Blynk IOT version its still connecting to the legacy version. Please help me I'll provide the code

`#define BLYNK_TEMPLATE_ID ""

define BLYNK_DEVICE_NAME ""

define BLYNK_AUTH_TOKEN ""

define BLYNK_PRINT Serial

include

include

include

include

include

include

define ONE_WIRE_BUS D2

OneWire oneWire(ONE_WIRE_BUS);

DallasTemperature sensors(&oneWire);

char auth[] = ""

char ssid[] = ""

char pass[] = ""

define DHTPIN 2

define DHTTYPE DHT11

DHT dht(DHTPIN, DHTTYPE);

SimpleTimer timer;

void sendSensor()

{

float h = dht.readHumidity();

float t = dht.readTemperature();

if (isnan(h) || isnan(t)) {

Serial.println("Failed to read from DHT sensor!");

return;

}

Blynk.virtualWrite(V5, h); //V5 is for Humidity

Blynk.virtualWrite(V6, t); //V6 is for Temperature

}

void setup()

{

Serial.begin(9600);

dht.begin();

timer.setInterval(1000L, sendSensor);

Blynk.begin(auth, ssid, pass);

sensors.begin();

}

int sensor=0;

int output=0;

void sendTemps()

{

sensor=analogRead(A0);

output=(145-map(sensor,0,1023,0,100)); //in place 145 there is 100(it change with the change in sensor)

delay(1000);

sensors.requestTemperatures();

float temp = sensors.getTempCByIndex(0);

Serial.println(temp);

Serial.print("moisture = ");

Serial.print(output);

Serial.println("%");

Blynk.virtualWrite(V1, temp);

Blynk.virtualWrite(V2,output);

delay(1000);

}

void loop()

{

Blynk.run();

timer.run();

sendTemps();

}`

Please help me !!! I'm using all the latest libraries of Blynk

Atomix2402 commented 1 year ago

@doom369 @blynkkk Would you look at this issue please

EarlOld commented 1 year ago

@Atomix2402 please check server URL. You need to connect to blynk.cloud

EarlOld commented 1 year ago

@Atomix2402 just replace Blynk.begin(auth, ssid, pass); to Blynk.begin(auth, ssid, pass, "blynk.cloud", 80);