Token error and syntax problems (solved)

Hi everyone,
I have build a local blynk server (with raspberry pi) and in my mind he works (phone connect and sending token working). I try for starting and testing a simple switch LED (external) on/off. I use a ESP32 board, put the correct strings for auth, ssid, pass into the code. After startup the ESP32 is logged in into the local WLAN but I get the message “token invalid”. In my mind - the ESP32 is only logged in into the WLAN but not into the local blynk server. This is my main issue.
Next I try to write server IP and port into the code and get permanently a compiler error:

code: Blynk.begin(auth, ssid, pass, IPAddress(192,168,178,139), 8080);
message: ‘Blynk’ does not name a type

I also try
char server[] = “”
Blynk.begin(auth, ssid, pass, server, 8080);
the same error message
Now my question: What is the correct syntax for blank.begin? I know from other programming languages structured documentation about the syntax of the commands - here I miss it or I’m too stupid to find it…
Maybe my main problem (token) could be have a other reason? But the issue with the syntax still exist.
Thanks in advance.

You need to provide the full code, so that we can have a look and probably say where you are missing out.
Check the auth token for any extra spaces or special character which dont belong there…


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

See if this solves your problem.

Hi Madhukesh,
thanks for help. Now I have seen the message from the serial monitor:

[180654] Connecting to
[180706] Invalid auth token

Quite clearly: he try to connect to the blynk-cloud and not to my local server…
In my code (sea below) is missing the information for my local server.

#define BLYNK_PRINT Serial

int pin        = 21;

#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>

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

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "xxxxxxx";
char pass[] = "yyyyyy";

void setup() {  
  pinMode(pin, OUTPUT); 
  pinMode(pin, HIGH);

  Serial.print("Connecting to ");

  WiFi.begin(ssid, pass);
  int wifi_ctr = 0;
  while (WiFi.status() != WL_CONNECTED) {

  Serial.println("WiFi connected");  

  Blynk.begin(auth, ssid, pass);


void loop(){;

Now I try your code, define server and port in the same way (char[] = …) and get every time the same compiler error message. What is the correct syntax?


I have generated a new token, extended the code (in this form from the compiler accepted) :

 WiFi.begin(ssid, pass);
 Blynk.config("96d730aba71345e6bbb4717b4483624f", IPAddress(192, 168, 178, 139), 8080);

But the result is the same - try to connect the blynk-cloud…

This error message will occur if the Blynk libraries aren’t correctly installed on your PC, or if you don’t include the libraries in your code. However, that doesn’t seem to be the cause in your case.
It seems more likely that you have a syntax error elsewhere in your code which is confusing the compiler, or you have Mia-spelled “Blynk”. This can include not having a capital “B”.
You’ve done exactly that here:

Unless you share your exact code and copy/paste the error messages then it’s impossible for us to tell.

The code you have shared is regather odd, because it includes both WiFi.begin and Blynk.begin. The WiFi.begin is unnecessary when using Blynk.begin.

You’ve told us that you’ve made other changes to the code, but you haven’t shared the full code with these changes.
I suspect that you still have a Blynk.begin in your code, along with the Blynk.config, but that you are missing a Blynk.connect command.

Have you read the documentation:


Now I try this

char server[] = "";
int port = 8080;
Blynk.begin(auth, ssid, pass, server, port);

and it works. The issue was the incorrect defined variable for “port”. Why Blynk.config doesn’t work I can’t say…
Thanks and best regrads

I think that if you read my previous post it will give you some clues, but snippets of code make life difficult for us!


1 Like