Invalid Auth token with Wifimanager

Hello Blynkers !!

I have been using Wifimanager with Blynk from past many months !! And it works fine without any issues… But yesterday we tried the same sketch with my friends nodemcu at his place and i started getting invalid auth token displayed in the serial monitor !!!

I have never faced this issue before. No changes made in the code too !! But pasting the same auth directly in the code char auth[] = "xxxxxxxxxxxxxxxxxxxxxxxxxxxx";
will do the trick !! I have also checked if there are any empty spaces in the auth token while pasting in the config portal but no empty spaces !!

But for the first time when i configure the device it connects NO PROBLEM… But after reboot it says invalid auth token. So to reconfigure when i enter the ondemand portal in the auth column there will be only 5 to 6 characters with some random symbols !!
Is the module’s SPIFFS failing to store the auth token ?

char auth[34];

or

char auth[34] = "";
WiFiManagerParameter custom_auth("blynk", "blynk token", auth, 34);

Both should work fine right ??
I read quite a bit of threads in the forum with the similar problem, but i did not feel any of that will help me solve my problem …
But hard coding the auth token will work fine. So the whole point of using wifimanager is not fulfilling the need…

First of all, ensure that you’ve uploaded the sketch with a memory option that allocates some SPIFFS memory.
Try in-commenting the line that formats the SPIFFS, upload the code and run it once, then re-comment the line and upload it again.

Also check that the serial monitor is showing the correct Auth code (no truncated characters) and that you aren’t getting any other meaningful messages in the serial monitor.

Pete.

4M(3M, SPIFFS)… Sure this was the setting

Its showing the exact Auth token…

Now i dont have that exact module that gave me this problem… But none of my other nodemcu’s are giving this problem(same sketch, same settings, same computer, same core, same lib’s). Infact this is the first time i am facing problem…

Not sure what caused the problem… Was it the device itself :face_with_monocle:

I don’t know, but if the SPIFFS memory has been used in a different way previously on that NodeMCU then it may need formatting to make it useable.
Either way, the data from the serial monitor is usually pretty useful if you clear the screen at the beginning of the process then scroll back when you’ve inputted the data and follow the flow of the debug messages you can pretty quickly spot where things are going wrong.

Pete.

Hello Pete !
First of all Happy new year ! Thank you for all the support and knowledge shared by you on this forum !!

Its a new module. I had uploaded the sketch and later when i gave the module to my friend to configure it… Invalid Token error occurred. This is the first time i faced this issue !! I am using Blynk from past few years !! But never faced this issue !! In fact i tried the same sketch with my old NODEMCU and it never gave problem.

I learned this from you and i always do this before writing here in the Forum. I did not find anything miss happ in the serial monitor. The auth token was printed correctly in the serial monitor.

So post the full serial monitor output, including the Auth code (this can be changed later).

Pete.

That module is not available now(I will try getting back the module) . With other modules i am not having this problem. If i get the same problem again… I will post it here…

So you gave the device to your friend, who entered an Auth code for a Blynk account/project/device that he has created in the app on his phone - is that correct?

How do you know that he entered the Auth code correctly, and that no characters were truncated?

Did you personally study the output from his serial monitor?

Are you both using the Blynk cloud servers?

Pete.

Yes you got it right.

Actually i entered the auth token. I copied the auth token from the app and pasted it in the Wifimanager config portal. It connects for the first time. Later when the device reboots it says invalid auth token in the serial monitor. But hard coding the same auth token in the char[34] = "xxxxxxxxxxxxxxxxxx" will work fine.

But the same sketch is working fine with my oher module. The only way to find out the problem is getting back the module which malfunctioned.

When it said invalid auth token for the first time, i thought there must be some space or “.” in the auth token i pasted in the config portal. So when i tried to re-configure the device “on-demand portal” (usually it displays the last stored token in the auth field in the config web portal) but this time there were only like 5 to 6 characters with some “???” and special characters.

SPIFFS.format();
i use this in the on demand portal to erase the previously stored data. But this on demand portal is called only to reconfigure. This is not in setup or loop. Only when a button is pushed this function is called. So this is not erasing my token for sure.

Yes. Ultimately it connected to the cloud after hard coding the auth token. If we were using the local server’s token we would have never made it right ?

Hi all!.

Could anyone figured this out?, im having the same issue.

Thanks a lot!

Please explain your issue. And also please show us your code till date. So we can have a look and try to solve the issue.
Please format your code properly before posting with triple backticks. " ``` "

@marty1982 please don’t keep posting “me too” in old topics and expecting a sensible answer. Create your own topic, and provide the relevant information needed to obtain an answer to your issue.
I’ve locked this topic, and the other one where you’ve done the same thing.

Pete.