Migration Legacy -> IOT

Hi everybody

I have an app working for several years using ESP8266 and Blynk legacy

I try to migrate and I encounter some problems

I added
#define BLYNK_TEMPLATE_ID “xxxxxxxxxxxxxxxxxxxxx”
#define BLYNK_DEVICE_NAME “yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy”
#define BLYNK_AUTH_TOKEN “zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz”

at the top of my code.

Some times it works and I can connect, but some times it does not work and I have the message
invalid auth_token (the source code is unchanged)

What can happend ?

I’d suggest that you start by telling is which version of the Blynk library you have installed, what hardware and connection method you are using, and posting your sketch and your serial output.

Your sketch and serial output should be posted with triple backticks at the beginning and end so that they display correctly.
Triple backticks look like this:


Hi Pete,

My ketch is really complicated, I cannot post it . But I have the same problem with a given example “nodemcu”

I use wifi and I downloaded the latest version of blynk

here after the sketch:

  Download latest Blynk library here:

  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

  Blynk library is licensed under MIT license
  This example code is in public domain.

  This example runs directly on NodeMCU.

  Note: This requires ESP8266 support package:

  Please be sure to select the right NodeMCU module
  in the Tools -> Board menu!

  For advanced settings please follow ESP examples :
   - ESP8266_Standalone_Manual_IP.ino
   - ESP8266_Standalone_SmartConfig.ino
   - ESP8266_Standalone_SSL.ino

  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
#define BLYNK_DEBUG        // Optional, this enables more detailed prints

/* Fill-in your Template ID (only if using Blynk.Cloud) */

#define BLYNK_TEMPLATE_ID "Txxxxxxxxxxxxxxxxxxxx7"
#define BLYNK_DEVICE_NAME "Commande des Volets"
#define BLYNK_AUTH_TOKEN "Azzzzzzzzzzzzzzzzzzzzzzv"

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "here is my token";

// Your WiFi credentials.
// Set password to "" for open networks.
   char ssid[]         = "Livebox-AE50";
   char pass[]     = "xxxxxxxxxxxxxxxxxxxxxxx";
void setup()
  // Debug console

  Blynk.begin(auth, ssid, pass);
  // You can also specify server:
 // Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
 // Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,30), 80);

void loop()

and the serial output when it works is :

Connected to Livebox-AE50
IP address:
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v1.1.0 on ESP8266

 #StandWithUkraine    https://bit.ly/swua

[3912] Connecting to blynk.cloud:80
[3948] <[1D|00|01|00] here is my tocken
[3970] >[00|00|01|00|C8]
[3970] Ready (ping: 21ms).
[3970] Free RAM: 47368

and when it doesnot work

Connected to Livebox-AE50
IP address:
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.6.1 on ESP8266

[3908] Connecting to blynk-cloud.com:80
[3941] <[1D|00|01|00] here is my tocken
[3966] >[00|00|01|00|09]
[3966] Invalid auth token

you’ll notice that in the case of not working the cloud server is wrong !

Your description of the error makes it sound as though sometimes when your device boots-up it works, and other times it doesn’t.

However, your serial output shows that you are re-compiling and re-uploading the sketch, and that sometimes Blynk library version 1.1.0 is being used and other times library version 0.6.1 is being used…

Library versions 0.6.1 and earlier were used by Legacy Blynk, and they don’t know how to handle the BLYNK_TEMPLATE_ID and BLYNK_DEVICE_NAME lines of code and use these to force a connection to the new Blynk IoT servers.

Are you using two different machines to compile your code, one with Blynk library version 1.1.0 and the other with version 0.6.1 installed?

Or, have you done something weird with your Blynk library installation which has kept both versions installed on your computer?


Thank for your clue !
i checked the libaries and I found 2 Blynk Library in the arduino lib folder in the same machine.

Maybe the compiler take one or the other library

I deleted the older and recompile and run

It seems working, I will keep you informed

1 Like