BLYNK
BLYNK.IO       📲 GETTING STARTED       📗 DOCS       👉 SKETCH BUILDER

Invalid Auth Token, HELP

Hi.
I’m having a problem with the auth token, i was trying to control my Arduino Uno board through Blynk with the Nodemcu ESP8266. I was following a guide on arduino project hub and the auth token i have was invalid. It’s my fist time using Blynk and Nodemcu so if anyone could help me i’ll be very grateful.

/*************************************************************
 Download latest Blynk library here:
   https://github.com/blynkkk/blynk-library/releases/latest
 Blynk is a platform with iOS and Android apps to control
 Arduino, Raspberry Pi and the likes over the Internet.
 You can easily build graphic interfaces for all your
 projects by simply dragging and dropping widgets.
   Downloads, docs, tutorials: http://www.blynk.cc
   Sketch generator:           http://examples.blynk.cc
   Blynk community:            http://community.blynk.cc
   Follow us:                  http://www.fb.com/blynkapp
                               http://twitter.com/blynk_app
 Blynk library is licensed under MIT license
 This example code is in public domain.
*************************************************************
 This example shows how to use ESP8266 Shield (with AT commands)
 to connect your project to Blynk.
 WARNING!
   It's very tricky to get it working. Please read this article:
   http://help.blynk.cc/hardware-and-libraries/arduino/esp8266-with-at-firmware
 Change WiFi ssid, pass, and Blynk auth token to run :)
 Feel free to apply it to any other example. It's simple!
*************************************************************/
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>

char auth[] = "Fl3EEUo_K2Y2NYfRcff8jRMaGmTzgVql";
char ssid[] = "xxxxxxxx";
char pass[] = "xxxxxxxx";

#define ESP8266_BAUD 115200
ESP8266 wifi(&Serial);
void setup()
{
 // Debug console
 Serial.begin(9600);
 delay(10);
 // Set ESP8266 baud rate
 Serial.begin(ESP8266_BAUD);
 delay(10);
 Blynk.begin(auth, wifi, ssid, pass);
}
void loop()
{
 Blynk.run();
}

Here the terminal:

Blynk legacy or IOT ?

I am using Blynk IoT.

Read this
https://docs.blynk.io/en/blynk-1.0-and-2.0-comparison/migrate-from-1.0-to-2.0

and make sure that you are using the right auth token

I did use the token that Blynk give me like in your picture and my Blynk libary version is 1.0.1

You should Add BLYNK_TEMPLATE_ID and BLYNK_DEVICE_NAME on top of your sketch, above any includes.

You need to copy all three lines of the firmware configuration from the screen that @John93 has screenshotted, and paste it at the top of your code.

You should then change this line:

to this:

char auth[] = BLYNK_AUTH_TOKEN;

Pete.

Also, if this statement is correct…

then I have to ask why you are trying to do this in the first place.

Pete.

Is my college graduation project and i have submit the name of the project is design a model using Arduino and ESP8266 and i can change it, it main feature is that i can control and monitor all the device in the model through Blynk and that is why i have to do it.

I have try to change it to char auth[] = BLYNK_AUTH_TOKEN; like you said but is still show up as invalid auth token, i even try to create another new template and device.

That wasn’t the only thing that you were told that you need to do.
Have you ignored all of the others?

Pete.

No, i also add all three line from the firmware like you said and it still invalid.

I’d suggest that you post your amended code.

Pete.

Here it is:

#define BLYNK_PRINT Serial
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>

#define BLYNK_TEMPLATE_ID "TMPLOZxApMAS"
#define BLYNK_DEVICE_NAME "TTT"
#define BLYNK_AUTH_TOKEN "reWSaAt4zrxoYi0lTUcVK-kQDkVxaywt"

char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "xxxxxxx";
char pass[] = "xxxxxxx";

#define ESP8266_BAUD 115200
ESP8266 wifi(&Serial);
void setup()
{
 // Debug console
 Serial.begin(9600);
 delay(10);
 // Set ESP8266 baud rate
 Serial.begin(ESP8266_BAUD);
 delay(10);
 Blynk.begin(auth, wifi, ssid, pass);
}
void loop()
{
 Blynk.run();
}

Not very good at following instructions are you?….

Pete.

I’m so sorry, i did see that, let me change it and see if it help.

After i change it, it is working fine now, thank you sir for spend your time and help me.

1 Like