0

MQTT feed publish not authorized
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

MQTT feed publish not authorized

by sylvain_mougenot on Sun Jul 28, 2019 11:03 am

After a long time I'm comming back to adafruit io.
I'd like to make a demo for my friends

But today I can not make adafruit mqtt api work. Error retrieved (on topic sylvain_mougenot∕errors) says
Code: Select all | TOGGLE FULL SIZE
publication to sylvain_mougenot∕feeds∕anotherfortest failed: publish is not authorized, user is temporarily blocked


I could not find any help about that error messsage (would be a nice addition to the doc : error message with guidance on how to fix them)
I tried different approches to debug that without any success
    from esp8266
    from mqtt client
    using nodered

Message is a simple 2 digit integer (e.g. 22)
Topic is based on pattern <username>/feeds/<feed_key>

sylvain_mougenot
 
Posts: 4
Joined: Wed Sep 27, 2017 12:39 pm

Re: MQTT feed publish not authorized

by adafruit_support_carter on Mon Jul 29, 2019 6:28 pm

"Coming back" from how long an absence? Maybe you were using it before the subscriptions were turned on and the free access was given rate limits?
Free Usage
Feeds: 8 of 10
Dashboards: 5 of 5
Rate: 30 / minute
Current Usage: 1 / min
Storage: 30 days


As a quick check, can you log into your account via a browser and manually push some data to the feed?

adafruit_support_carter
 
Posts: 12675
Joined: Tue Nov 29, 2016 2:45 pm

Re: MQTT feed publish not authorized

by abachman on Tue Jul 30, 2019 10:09 am

Hi sylvain,


You'll also see that error message if another MQTT client process on another device overloaded Adafruit IO and caused your whole account to be blocked temporarily from MQTT access. The most common way for that to happen is to publish so many messages within a short window that it received so many throttled warnings that it was eventually blocked.

We also disconnect clients that make PUBLISH or SUBSCRIBE requests with invalid MQTT topics. Using a platform like nodered sometimes comes with defaults that assume you have full control of the MQTT broker. For example, silently making requests to $SYS/* topics or creating initial subscriptions based on a template or topic scheme that IO doesn't use.

It's also possible that there is a client very quickly attempting to log in with old credentials. If you changed / regenerated your AIO Key before setting up your demo, then any old clients would be attempting to log into your account with invalid credentials which would trigger a temporary block. That scenario is more likely to appear as being unable to sign in, though. Invalid logins don't show up on https://io.adafruit.com/monitor right now, but it would probably be helpful if they did.

So the two big things to check for here are: 1) are there other devices or scripts connecting to IO? and 2) are you absolutely sure your sketch is only sending requests for legal Adafruit IO topics?


- adam

abachman
 
Posts: 319
Joined: Mon Feb 01, 2010 12:48 pm

Re: MQTT feed publish not authorized

by sylvain_mougenot on Thu Aug 01, 2019 5:16 pm

Thank you all for the ideas on what to check.
I'm pretty sure it is not related to my activity but to a strange state of my account.

1- Now I only do tests from my computer (no other device / soft are involved)
2- I use a command line tool to send 1 simple message
3- I did not use the service for several days

Result is the same (from the monitor on my profile)
Code: Select all | TOGGLE FULL SIZE
1 error

2019/08/01 10:54pm publication to sylvain_mougenot∕feeds∕anotherfortest failed: publish is not authorized, user is temporarily blocked
Live Data newest data at the top

Connections only available while this page is open
2019/08/01 10:54:23pmmosq/CqaOWa09ZBTXddnOZZdisconnected
2019/08/01 10:54:23pmmosq/CqaOWa09ZBTXddnOZZconnected


The code used is a very simple shell
Code: Select all | TOGGLE FULL SIZE
#!/usr/bin/env bash

# -------- CONF -----------

host='io.adafruit.com'
port='1883'
user='sylvain_mougenot'
password='5...7'

topic='sylvain_mougenot∕feeds∕anotherfortest'
message='22'

# -------- RUN ------------

mosquitto_pub -h "$host" -p $port \
   -u "$user" -P "$password" \
   -t "$topic" -m "$message" \
   -d


logs are :
Code: Select all | TOGGLE FULL SIZE
smougenot  sqli  22:54:23  67%  work  …  esp8266_sensor  master  ⬆  ?  $  sh ./src/adafruit_test.sh
Client mosq/nPbsqINXNjeklaqxWq sending CONNECT
Client mosq/nPbsqINXNjeklaqxWq received CONNACK (0)
Client mosq/nPbsqINXNjeklaqxWq sending PUBLISH (d0, q0, r0, m1, 'sylvain_mougenot∕feeds∕anotherfortest', ... (2 bytes))
Client mosq/nPbsqINXNjeklaqxWq sending DISCONNECT



I can not think of a simpler test.
Here a simple screen cast of the test

Peek_adafruit_io_test_01-08-2019 23-08.gif
screen_cast_of_the_test
Peek_adafruit_io_test_01-08-2019 23-08.gif (527.04 KiB) Viewed 87 times


What can I do?

sylvain_mougenot
 
Posts: 4
Joined: Wed Sep 27, 2017 12:39 pm

Re: MQTT feed publish not authorized

by sylvain_mougenot on Thu Aug 01, 2019 5:21 pm

I forget, I used the manual way to add data to the feed (using my profile page on the browser) and it worked.

sylvain_mougenot
 
Posts: 4
Joined: Wed Sep 27, 2017 12:39 pm

Re: MQTT feed publish not authorized

by sylvain_mougenot on Tue Aug 06, 2019 3:34 pm

Please could any one help

sylvain_mougenot
 
Posts: 4
Joined: Wed Sep 27, 2017 12:39 pm

Re: MQTT feed publish not authorized

by abachman on Thu Aug 08, 2019 10:13 am

hi sylvain,


If you're able to connect to an IO dashboard and interact with a feed--for example, drag a slider and see a gauge change--then MQTT is working alright for your account. All live dashboard interactions on io.adafruit.com run through the same MQTT system as devices and custom scripts/apps/sketches.

If that's working for you and you don't see the red "can't connect" status bar at the top of the browser window when visiting io.adafruit.com, then there's probably an issue with the MQTT client you're using. It could be adding characters to the topic? Could be a badly formed PUBLISH packet? Are you able to use any other language or library to publish over MQTT?


- adam

abachman
 
Posts: 319
Joined: Mon Feb 01, 2010 12:48 pm

Please be positive and constructive with your questions and comments.