Help with Invalid Auth Token NodeMCU Board

I am using the new blynk app 2.0. Do they still hand out 32 character token authorization keys?

I did not get an email for my project. Here is my code.

//Viral Science www.viralsciencecreativity.com www.youtube.com/c/viralscience
//Realtime GPS Tracker with Nodemcu ESP8266
#include <TinyGPS++.h>
#include <SoftwareSerial.h>
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
//#include <BlynkSimpleEsp8266_SSL.h>

#define BLYNK_TEMPLATE_ID "TMPLI51PydZt"
#define BLYNK_DEVICE_NAME "GPS Tracker"

static const int RXPin = 4, TXPin = 5;   // GPIO 4=D2(conneect Tx of GPS) and GPIO 5=D1(Connect Rx of GPS
static const uint32_t GPSBaud = 9600; //if Baud rate 9600 didn't work in your case then use 4800

TinyGPSPlus gps; // The TinyGPS++ object
WidgetMap myMap(V0);  // V0 for virtual pin of Map Widget

SoftwareSerial ss(RXPin, TXPin);  // The serial connection to the GPS device

BlynkTimer timer;

float spd;       //Variable  to store the speed
float sats;      //Variable to store no. of satellites response
String bearing;  //Variable to store orientation or direction of GPS

char auth[] = "--------------------";              //Your Project authentication key
char ssid[] = "ORBI88";                                       // Name of your network (HotSpot or Router name)
char pass[] = "rapidearth125";                                      // Corresponding Password

//unsigned int move_index;         // moving index, to be used later
unsigned int move_index = 1;       // fixed location for now
  

void setup()
{
  Serial.begin(115200);
  Serial.println();
  ss.begin(GPSBaud);
  //Blynk.begin(auth, ssid, pass);
  Blynk.begin(auth, ssid, pass, "blynk.cloud.com", 80);
  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);
  timer.setInterval(5000L, checkGPS); // every 5s check if GPS is connected, only really needs to be done once
}

void checkGPS(){
  if (gps.charsProcessed() < 10)
  {
    Serial.println(F("No GPS detected: check wiring."));
      Blynk.virtualWrite(V4, "GPS ERROR");  // Value Display widget  on V4 if GPS not detected
  }
}

void loop()
{
    while (ss.available() > 0) 
    {
      // sketch displays information every time a new sentence is correctly encoded.
      if (gps.encode(ss.read()))
        displayInfo();
  }
  Blynk.run();
  timer.run();
}

void displayInfo()
{ 
  if (gps.location.isValid() ) 
  {    
    float latitude = (gps.location.lat());     //Storing the Lat. and Lon. 
    float longitude = (gps.location.lng()); 
    
    Serial.print("LAT:  ");
    Serial.println(latitude, 6);  // float to x decimal places
    Serial.print("LONG: ");
    Serial.println(longitude, 6);
    Blynk.virtualWrite(V1, String(latitude, 6));   
    Blynk.virtualWrite(V2, String(longitude, 6));  
    myMap.location(move_index, latitude, longitude, "GPS_Location");
    spd = gps.speed.kmph();               //get speed
       Blynk.virtualWrite(V3, spd);
       
       sats = gps.satellites.value();    //get number of satellites
       Blynk.virtualWrite(V4, sats);

       bearing = TinyGPSPlus::cardinal(gps.course.value()); // get the direction
       Blynk.virtualWrite(V5, bearing);                   
  }
  
 Serial.println();
}

Please edit your post and add triple backticks ( ``` ) before and after your whole sketch.

Yes, to get the auth token, go to the console/devices/device info


and make sure that you are using the latest version of blynk library

The new blynk server is blynk.cloud, blynk-cloud.com belongs to the old blynk.

also, I think you should read this

Thanks for the reply. My project does not appear on the search because it is still in developer mode. I have the NodeMCU and GPS connected. I have the code written and ive uploaded the code but I cant connect to the NodeMCU with my blynk app. I did the Blink tutorial and got that working but now im doing this project where im trying to get lat and long coordinates but it doesnt seem to be connecting. Screenshot below. Also, I changed the code to blink.cloud.com.

Second part of the code.

I tried. Not sure what this is supposed to do but let me know if i did it wrong.

Since I cant get my project to connect to the blynk app, is there something wrong with the internet code? After i upload code, I go to blynk and add new device but it wont connect or it cant be found…

It’s blynk.cloud only, there’s no.com

I think you’re failing to understand the process.
With the connection method you are using, after you have created the Template, you need to create the Device from that template.
Once you’ve done this, you will get the BLYNK_TEMPLATE_ID, BLYNK_DEVICE_NAME and BLYNK_AUTH_TOKEN.
These need to be the FIRST LINES of your sketch.

Also, when yo are posting code to the forum, please DO NOT POST SCREENSHOTS.

Copy and paste the code and put triple backticks on a blank line at the beginning and end of the code.
Triple backticks look like this:

```

Pete.

Please help,

I have the and i made the change to blynk.cloud. I upload my sketch (code). I go to blynk app to add new device but I’m not getting the esp8266 wifi to appear on my phone. What else could be wrong?

If I don’t get it to connect I cant get get authorization token it is asking for.

Post the updated sketch please.

My code is below.

//Realtime GPS Tracker with Nodemcu ESP8266
#include <TinyGPS++.h>
#include <SoftwareSerial.h>
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
//#include <BlynkSimpleEsp8266_SSL.h>

#define BLYNK_TEMPLATE_ID "TMPLSDoisDr9"
#define BLYNK_DEVICE_NAME "LED Blink"

static const int RXPin = 4, TXPin = 5;   // GPIO 4=D2(conneect Tx of GPS) and GPIO 5=D1(Connect Rx of GPS
static const uint32_t GPSBaud = 9600; //if Baud rate 9600 didn't work in your case then use 4800

TinyGPSPlus gps; // The TinyGPS++ object
WidgetMap myMap(V0);  // V0 for virtual pin of Map Widget

SoftwareSerial ss(RXPin, TXPin);  // The serial connection to the GPS device

BlynkTimer timer;

float spd;       //Variable  to store the speed
float sats;      //Variable to store no. of satellites response
String bearing;  //Variable to store orientation or direction of GPS

char auth[] = "";              //Your Project authentication key
char ssid[] = "ORBI88";                                       // Name of your network (HotSpot or Router name)
char pass[] = "rapidearth125";                                      // Corresponding Password

//unsigned int move_index;         // moving index, to be used later
unsigned int move_index = 1;       // fixed location for now
  

void setup()
{
  Serial.begin(115200);
  Serial.println();
  ss.begin(GPSBaud);
  //Blynk.begin(auth, ssid, pass);
  Blynk.begin(auth, ssid, pass, "blynk.cloud", 80);
  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);
  timer.setInterval(5000L, checkGPS); // every 5s check if GPS is connected, only really needs to be done once
}

void checkGPS(){
  if (gps.charsProcessed() < 10)
  {
    Serial.println(F("No GPS detected: check wiring."));
      Blynk.virtualWrite(V4, "GPS ERROR");  // Value Display widget  on V4 if GPS not detected
  }
}

void loop()
{
    while (ss.available() > 0) 
    {
      // sketch displays information every time a new sentence is correctly encoded.
      if (gps.encode(ss.read()))
        displayInfo();
  }
  Blynk.run();
  timer.run();
}

void displayInfo()
{ 
  if (gps.location.isValid() ) 
  {    
    float latitude = (gps.location.lat());     //Storing the Lat. and Lon. 
    float longitude = (gps.location.lng()); 
    
    Serial.print("LAT:  ");
    Serial.println(latitude, 6);  // float to x decimal places
    Serial.print("LONG: ");
    Serial.println(longitude, 6);
    Blynk.virtualWrite(V1, String(latitude, 6));   
    Blynk.virtualWrite(V2, String(longitude, 6));  
    myMap.location(move_index, latitude, longitude, "GPS_Location");
    spd = gps.speed.kmph();               //get speed
       Blynk.virtualWrite(V3, spd);
       
       sats = gps.satellites.value();    //get number of satellites
       Blynk.virtualWrite(V4, sats);

       bearing = TinyGPSPlus::cardinal(gps.course.value()); // get the direction
       Blynk.virtualWrite(V5, bearing);                   
  }
  
 Serial.println();
}```

image

From here i go to the IOS blynk app but it does not find the wifi.

You didn’t like what I said in post #9 then?

Pete.

Sorry Pete,

I dont think i understood what you meant. I have no knowledge in this sorta stuff. I am trying to go by a youtube video but the individual who did this did it in the old blynk app and this code is no longer working I guess. I was hoping it would be as easy as copy and paste but it is not.

I am trying to simply get coordinates for a project I am doing that would track my dog in the back yard.
I am using a nodeMCU esp8266 and a ublox neo 6m.

If you would like to take the time and walk me through what you mean I would greatly appreciate it.

Here is what I have done so far:

  1. I created the template, added the data streams and saved.
  2. I have added the code you see above in arduino 1.8.19 and uploaded it.
  3. I have gone to the blynk app and added the widgets I need.
  4. Now I’m trying to add new device but it is not picking up the nodeMCU wifi.

Is this the way you suggested?

I guess the hangup is creating the device from the template. I cant create the device because when i try to add new device it is not finding it.

RTFM

The link to the documentation is here
activating-devices

Update, I got it going somewhat. Thanks to all who contributed.

Pete, I did add device from laptop instead of from phone and it gave me what I needed which was the authorization token.

image

Now my issue is with the app. It is giving me a 1 for latitude and o for longitude. Anyone know how I should be setting them up?

Its done. I just had to adjust the min and max of each data stream.

1 Like