Mqtt invalid token error in console app

Hello all, I am a new to ttn and mqtt but I was able to create a mqtt and connect my node-red app to communicate a month ago. Then, I had to do some more testing and deleted the old key and created a new one. Since then, I keep getting “Fail to connect to mqtt” and “Invalid token” error messages.

Any idea what could be wrong?

I used copy/paste method to copy the key from email to node-red config, but it still cannot connect.

Copy your key from the console when you create it,not the e-mail.

Seems the e-mail are missing some preambles, at lease mine did, NNSXS.


The ONLY time you get access to the key is when it is on the web page - you have to copy it then. The other long sequence is the key id so that it can be referred to in the CLI and similar.

1 Like

Thanks…I will try later when I get home…but I know that there is no “NNSXS” or such. I guess I will have to recreate the key again.

Well, the problem is partially solved…the NNSXS part was missing, so Node-red is now connecting fine, brings in the payload, however, I still get “Fail to connect to MQQT”.

Any other ideas? Is Node-red causing this message to be displayed or it is my console app?

You are missing more than just that.

Delete your existing API, recreate it and copy it from the console.

1 Like

I recreated it but where should I copy the API key? I stored it in the txt file for future reference but do I need to copy it to some other place?

When you create it you need to copy it, I think you need to red the documentation a bit more.


Hi, I will reread it…I understood I needed to copy the API key somewhere and not MQTT key. I copied MQTT key in config of Node-Red and that’s how it’s connected. Last night was the first time I saw “fail to connect to mqtt” error.

Sorry about the trouble.

How many MQTT connections di you have to TTN?

Also look ate the live data in your application console, what do yo see their?

I have just one connection…and live data shows the error:

Have you recreated the key and copied it straight from TTN console and pasted it in MQTT node?

Yes I did, and I got payload information in node-red.

Did you enable TLS?

TLS? no.


I don’t suppose I have to use TLS configuration?

Change the port to 8883 and check the TLS box, let see what happens…,…

:slight_smile: I don’t have TLS certificates…I would have to configure additionally.

Actually, it did connect.