Why did my IO Key Change?

Moderators: adafruit_support_bill, adafruit

Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
Locked
User avatar
mmicatka
 
Posts: 7
Joined: Sun Jun 06, 2021 11:36 am

Why did my IO Key Change?

Post by mmicatka »

I was working on a project using the ESP8266 board integrating with a MQTT feed through Adafruit IO.
Everything was working fine, I left my project running for a few hours to make sure things were gravy.

After ~6 hours, my devices stopped working and, upon further investigation, I realized it was because my API key had changed. I definitely didn't do this (I didn't do ANYTHING, just left it running). And I'm confident the key changed (as opposed to a typo) because that same API key was hardcoded into a bunch of projects that all were working and stopped at the same time.

What happened? Why would this happen? Was there some auto-regen to do with requests? I was only making MQTT pings every few hours at most.

I'm making this wifi device as a holiday gift for someone, so I'd like to resolve this before I hand it over! Any help is appreciated.

Thanks!

EDIT:

I got a *belated email from Adafruit explaining things! I pushed my code to my github and the config file included my IO key - I had accidentally set the repo visibility to public. As a result, Adafruit automatically reset my key.

As an aside, I'm confused why this:

Code: Select all

Serial.print(mqtt.connectErrorString(ret));
Returns this:

Code: Select all

Connection Failed
I finally debugged my issue by looking at a sample python script that returned this error message:

Code: Select all

Adafruit IO request failed: 401 Unauthorized - request failed - invalid API key provided
Which is far more helpful. What's the corresponding function to get this info on the arduino side?

User avatar
brubell
Learn User Page
 
Posts: 2010
Joined: Fri Jul 17, 2015 10:33 pm

Re: Why did my IO Key Change?

Post by brubell »

I got a *belated email from Adafruit explaining things! I pushed my code to my github and the config file included my IO key - I had accidentally set the repo visibility to public. As a result, Adafruit automatically reset my key.
For security purposes, we have an automation set up to revoke and reassign keys that were posted publicly on GitHub.
Which is far more helpful. What's the corresponding function to get this info on the arduino side?
If you're using the Adafruit MQTT Arduino library - that's a library designed to work with any MQTT broker and the expected return response.

The Adafruit IO Arduino (https://github.com/adafruit/Adafruit_IO_Arduino) and Adafruit IO Python libraries sit on top of the Adafruit MQTT library and offer status states specific to Adafruit IO - https://github.com/adafruit/Adafruit_IO ... ons.h#L138

Locked
Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.

Return to “Internet of Things: Adafruit IO and Wippersnapper”