Invalid Auth Token on local Server (ESP8266 / NodeMCU)

• Hardware model + communication type.
NodeMCU with Wifi
• Smartphone OS
Android OS
• Blynk server or local server
Local Server
• Blynk Library version
0.5.0
• sketch code.

This Project include 3 Devices, 2 of them connecting succesful, The new device doesn’t
same (working code) with auth token:

char auth[] = “​5fbc5f8ca25746958eb8da76eb8960f8”;

here the token from local Admin Page: (http://192.168.0.59:8080/admin#/users/edit/
Id: 18874
Name: New Device
BoardType: ESP8266 (also tried with NodeMCU)
Token: 5fbc5f8ca25746958eb8da76eb8960f8
LastLoggedIP
ConnectionType: WI_FI

I tried to change the token round about 10 times, no success.

Device in Admin page and also Android application deleted and new added after log off and log on, no success.

still:

    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.5.0 on NodeMCU

[21746] Connecting to 192.168.0.59
[21763] Invalid auth token
[26758] Connecting to 192.168.0.59
[26769] Invalid auth token
[31764] Connecting to 192.168.0.59
[31772] Invalid auth token

any ideas?
regards hills8

*Edit: also tried to reboot Blynk Server and Raspberry.

*Edit2: serial print with active debugging:

[42321] Connecting to 192.168.0.59
[42324] <[02|00|01|00]#[E2|80|8B]5fbc5f8ca25746958eb8da76eb8960f8
[42331] >[00|00|01|00|09]
[42331] Invalid auth token

Can you show screenshots of your My Devices page and of the Device in question?

For example…

image

OK, please show FULL sketch, with same AUTH token, of the affected device.

Format it after pasting here like this…

Blynk - FTFC

#define BLYNK_DEBUG
#define BLYNK_PRINT Serial

#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <ArduinoJson.h>
#include <WiFiClient.h>
#include <WiFiUdp.h>
#include <TimeLib.h>  //download at https://github.com/PaulStoffregen/Time
#include <BlynkSimpleEsp8266.h>
#include <ArduinoOTA.h>

// your settings -------
char ssid[] = "(.)(.)";
char pass[] = "Welcome2(.)(.)";
char auth[] = "​5fbc5f8ca25746958eb8da76eb8960f8";

void setup() {
  Serial.begin(115200);
  //Blynk.config(auth);
  //Blynk.connectWiFi(ssid, pass);
  //Blynk.disconnect(); 
  
  Serial.println("connecting to Blynk Server");
  Blynk.begin(auth, ssid, pass, IPAddress(192,168,0,59));
  Serial.println("Connection etablished!");
}

void loop() {
  ArduinoOTA.handle();
  Blynk.run();
}

Try this simpler sketch…

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

char auth[] = "​5fbc5f8ca25746958eb8da76eb8960f8";
char ssid[] = "(.)(.)";
char pass[] = "Welcome2(.)(.)";
char server[] = "192.168.0.59";
int port = 8080;

void setup() {
  Serial.begin(115200);
  Serial.println("Connecting to Blynk Server");

  WiFi.begin(ssid, pass); 
  Blynk.config(auth, server, port);
  Blynk.connect();
}

void loop() {
  Blynk.run();
}

BLYNK_CONNECTED() {  // Run this function when connected to server
  Serial.println("Connection established!");
}

Login timeout.

I changed the Port to 8442 and get “Invalid token” again.

Here the device in my blynk admin:

Why?.. the proper port in the script to use is 8080.

What is your Local Server version?

my server version is still 0.33.1

regards hills8

You need to keep current with all updates on App, Server and Libraries… they are all intertwined and leaving one or more behind will cause these types of issues.

NOTE: you will need to make port changes to App (9443) and sketches (8080)… possibly even to any port forwarding you may have.

It is important to keep checking any new Announcements topics… saves us time troubleshooting something due to old components.

Okay, will Update all. Thank you

Okay, Library updated to v 0.5.2
server updated to 0.34.1
port changed back to 8080

[242847] Connecting to 192.168.0.59:8080
[242850] <[02|00|01|00]#[E2|80|8B]5fbc5f8ca25746958eb8da76eb8960f8
[242857] >[00|00|01|00|09]
[242857] Invalid auth token

AND i am not able to open the admin page anymore. I tired:
```cpp sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080 ````
and open following pages
(http://192.168.0.59:7443/admin)
(http://192.168.0.59:8080/admin)
(http://192.168.0.59:80/admin)
hills8

http://192.168.0.59:9443/admin

ERR_EMPTY_RESPONSE

https:// i missed that one…

https://192.168.0.59:9443/admin/.
HTTP ERROR 404

Ok, I’m out … :flushed:

but the server seems to listen to that port:

sudo netstat -tlpn Aktive Internetverbindungen (Nur Server)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 462/sshd
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 585/mysqld
tcp6 0 0 :::22 :::* LISTEN 462/sshd
tcp6 0 0 :::8440 :::* LISTEN 405/java
tcp6 0 0 :::8441 :::* LISTEN 405/java
tcp6 0 0 :::9443 :::* LISTEN 405/java
tcp6 0 0 :::8080 :::* LISTEN 405/java

hills8

80|8B this seems to be some invisible chars before your auth token. Try to remove your token and copy again without “hidden” chars.

Unicode copy/paste error?
U+200B ​ 0xe2 0x80 0x8b <-- matches the pattern

EDIT: U+200B = Zero width space…