Black Lives Matter - Action and Equality. ... Adafruit joins the Stop Hate for Profit campaign.

Changing API KEY does not create failure
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.
Please be positive and constructive with your questions and comments.

Changing API KEY does not create failure

by realmeday on Sun Oct 27, 2019 4:51 pm


I've been doing some testing with Adafruit IO error messages on a TFTdisplay. To test my logic for both the good case (data written) and the bad case (e.g. can't connect, etc.) I tried changing the API KEY through the web page to try to get it to trigger a failure on the TFT. No failures were triggered, and looking at my account's Monitor page, data is still being written every 30 seconds. The API KEY does indeed change, but it looks like even though the microcontroller is using an old KEY, Adafruit IO still accepts the data and records it. i et it run for 10 minutes to see if Adafruit IO has a time period where it eventually checks the KEY again but it's still logging data after 10-15 minutes. After rebooting the microcontroller, the Adafruit IO connection goes into a fail state, and Adafruit IO doesn't accept the data. My code prints the error messages to the TFT screen, and at this point, I get the ERR_BADKEY error code.

I'm also testing this microcontroller with another IoT service (ThingSpeak) and when I do the same test by generating a new API KEY on their site, when the microcontroller tries to log the data to ThingSpeak, the data is rejected immediately (no reboot of the deviced required) and the microcontroller gets the error code.

It appears that ThingSpeak checks that the API key is correct each time data is sent, where as Adafruit IO only verifies that the KEY is correct when it firsts connects. Is this correct? Is this intentional behavior?

It seems like if the key doesn't match while the connection is active on the microcontroller, Adafruit IO should reject the data when the KEY doesn't match any longer. However, Adafruit IO doesn't know about it until the device(s) are rebooted...

Posts: 6
Joined: Sun Feb 20, 2011 1:50 am

Please be positive and constructive with your questions and comments.