Getting "Connection Refused: not authorised" when trying to use MQTT

Hello
can you help me with configuring MQTT

because what I find in your site
still gives me a mistake

1 Like

that’s not enough info :wink:

by starting this

$mosquitto_sub -h eu.thethings.network -d -t '.../devices/../up'

he wrote this to me

–Connection Refused: not authorised.

I am recording and a pass a user
still gives me this

Your command line doesn’t show that. What are you using as the user, and what as the password? (So: show us that you’ve in fact read the documentation and tell us which documentation you’re using, rather than expecting people to list all possible problems.)

As an aside, '.../devices/.../up' is wrong too.

You need to provide an access token, similar to this:

mosquitto_sub -h eu.thethings.network -t '+/devices/+/events/activations' -u 'APP-ID' -P 'ACCESS-KEY' -v -p 1883

APP-ID is the actual name of your application.
ACCESS-KEY can be retrieved from the Overview page of your application (at the bottom)

1 Like

in this option I write it
mosquitto_sub -h eu.thethings.network -t '+/devices/+/events/activations' -u '70...................81' -P 'AB.......................E3' -v -p 1883

and yet it gives me a mistake
Connection Refused: not authorised.
Connection Refused: not authorised.

I use this documentation from my site
https://www.thethingsnetwork.org/docs/applications/mqtt/quick-start.html

Read the manual again.

AppID == Application ID, that should be a short ‘name’, listed at the top of all information on the application page. It is not an EUI number.
AppKey should start with ttn-account-.

2 Likes

I think you are using appeui not the actual application name as your user. Also, check you are using the access key, starting with ttn-account

thank you all
it finally came about
he has been stirring all the time
-u "<AppID>" -P "<AppKey>"
:beers:

Hello all,

I started playing with the Things Network recently.

I have successfully connected my device to the TTN and am able to see the packets being received by the TTN server on its application console.

However when trying to use MQTT (through mosquitto) on my laptop I am facing the same problem which @gandipg suffered.

On my laptop

I am entering the following cmd as mentioned in the Quick start tutorial

mosquitto_sub -h ev.thethings.network -t '+/devices/+/up' -u '2222' -P '...16 byte...' -v

I am getting Connection Refused: not authorised.

Now Mr @nicbkw mentioned that the access key starts with ttn-account.

On my application console my access-key doesn’t seem to start with that anywhere.

Any clues as to where I am going wrong.

Your help would be appreciated.

Kind Regards

That doesn’t look right. What region would ev be?

I just created a new application, and it still creates keys with that prefix. Maybe you can add a new key (for at least “messages”) to fix that? If not, create a new application?

Also, it’s a lot longer than 16 bytes, for me it’s 58 characters.

Quick response as I am in the pub…
If your application is called ‘2222’, then in the console open the overview for the application and it should look similar to this, just copy the key using the icon:

Screenshot_20180309-183712

Thank you both for your quick response.

@nicbkw - thank you for suggestion for looking at the overview of the console. That resolved the issue.
My mistake was to be entering the App Session Key for the device I registered.

@arjanvanb - ‘ev’ is a typo on my part when writing the question on this forum. I was using ‘eu’ as the region.

Regards

Hello,

when I try to connect with MQTT, getting “Connection Refused: not authorised.” but it was worked before. I am sure I use correct applikation Key, even I try to create new.

mosquitto_sub -h eu.thethings.network -t ‘+/devices/+/events/activations’ -u ‘70B3D57ESKIPPED’ -P ‘ttn-account-v2.skipped’ -v

For the user you need to use the application ID (short text string).

Hello,

Yes. I use EUIS

Ed

Ok. thanks seems it’s working now with application ID.

but I remember it’s worked before with EUIS