BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Blynk-client invalid token

Hi community !

I come back on Blynk with news RaspberryPi. All work fine expect when i add token on raspberry with “blynk-client”.

Raspberry Pi B buster lite
local server
Sony XZ 3 runing android

pi@raspberrypi:~ $ blynk-client XIjE0idvRLKyhvq4b5xGL43hSk2CiGbK

___  __          __

/ _ )/ /_ _____ / /__
/ _ / / // / _ / '/
/
//_, /////_
/
__/

Give Blynk a Github star! => https://github.com/vshymanskyy/blynk-library-js

OnOff mode
Connecting to: blynk-cloud.com 443
SSL authorization…
Connected
Could not login: INVALID_TOKEN
events.js:189
throw err; // Unhandled ‘error’ event
^

Error [ERR_UNHANDLED_ERROR]: Unhandled error. (‘INVALID_TOKEN’)
at Blynk.emit (events.js:187:17)
at Blynk.onReceive (/usr/lib/node_modules/blynk-library/blynk.js:466:20)
at exports.SslClient. (/usr/lib/node_modules/blynk-library/blynk.js:607:50)
at exports.SslClient.emit (events.js:198:13)
at TLSSocket. (/usr/lib/node_modules/blynk-library/blynk-node.js:212:16)
at TLSSocket.emit (events.js:198:13)
at addChunk (_stream_readable.js:288:12)
at readableAddChunk (_stream_readable.js:265:13)
at TLSSocket.Readable.push (_stream_readable.js:224:10)
at TLSWrap.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)

I don’t understand what happened… I use token from blynk application…

Somebody can help me ?

Thanks !

If this…

is your actual auth code then it isn’t a valid auth code for any of the Blynk cloud servers.

I’d imagine from your location that your project lives on the Frankfurt server, so the auth code can be tested using an API call direct to that server…

http://139.59.206.133/XIjE0idvRLKyhvq4b5xGL43hSk2CiGbK/project

and this returns “Invalid token.”

Have you copied and pasted the auth token directly from the Blynk email?

Pete.

Thanks @PeteKnight for your réponse.

Android blynk app give me this token…
I 'M on m’y smartphone i dont know i can send screen shot of mail token… But it’s this token.

Is your app logged-in to the Blynk cloud servers, not your own local server?

If the answer to both of these questions is “yes” then try generating a new Auth token and testing it with the API call I gave above.

Pete.

Ok it’s from my own serveur ( local serveur) all time
I try two times with différent auth token it’s all time same.

I used this this process (local serveur)

I log to m’y server ( ip adress + 9443)
I create account
I start New Project
And i recieve this auth token.

Well, you’ve not told your code to use the local server, which is why you are getting the invalid token message. Your server is only valid on your local server, so that’s where you must tell the client to connect.

Pete.

( it’s little dificult to understand i’m french)

You say i don’t need token for pairing Android and my local server ( on local network ?)

So when i come-back at home i send you step by step my process i think is better for explain.

Thanks for time you past for help me

No, that’s not what I said at all.

What I said is that you haven’t told your sketch which IP address and port to use to connect to your local server, so it is trying to connect to the cloud server instead.

The Auth codes from your local server and the cloud server are not interchangeable - your project which uses that unique Auth code exists on just one server, in your case your local server.
That is the server that you must instruct your device (the client on the Raspberry Pi) to connect to.

Pete.

So i do all with local serveur.

And this token don’t work…

Maybe is big mistake from myself… If it’s m’y bad thanks to explain me What i’ve to do

Thanks

You need to change the sketch that you upload to your Pi, so that it knows to connect to 192.168.1.35 and port 8080 or 9443 depending on whether you are using SSL or not.

You’ve not said what library you are using (I assume NodeJS or Python) and what version of the library.
I could tell you exactly how to do it in C++, but I have no idea in other languages.

Pete.

ok, thanks for your answer.

I format raspberry pi sd card and i restart from clean install. Is there exist a complete tutorial for all install for raspberry pi ?

Is this Pi your server and your client?

If so there is no need to reformat your SD card and reinstall the server.
There is no need to do that if you are using a separate client device either.

The first thing you should do is to tell us which client library you are running.

Pete.

My raspberry is serveur and client ( i will use gpio port for actionate relay, led and get value from temperature sensor for example ) and i control it from my smartphone

Serveur instalation is ok on my rapsberry

I keep asking what client library you are using, but you won’t tell me that!

Pete.

Sorry, i don’t know wich i have tu use. I think python it’s the Best for me

Well, the question was really about what library you are currently using to create the sketch which produced the output you posted earlier.

Pete.

Wich sketch you’re talking about ?

Maybe i tale wrong way that’s why i want restart all my installation and i’m looking for tutoriel since server installation ( this is OK for me) to actionate relais by Raspeberry GPIO.

We seem to be gong around in circles here.
In the first post in this topic you showed the output from your Blynk client, which was string to connect to the cloud server - because you haven’t specified the IP address and port of the local server in the client.

Now you don’t know which version of the client you used, and how you created the code that produced the serial output!

Re-installing the server won’t solve the problem, it will simply use-up time that would be better spent understanding how to configure the client to connect to the local rather than cloud server.

Pete.

I just follow this : https://www.youtube.com/watch?v=LJ3ic8C8CcA&t=109s

And when i use blynk-client command on my raspberry ( like in video ) i have what i send in my first post.
I do exactly same than video. Just i don’t know why it don’t work

Okay, so you’re using the NodeJS library!

Read this, it explains how to connect to your local server rather than the cloud server…

Pete.