$ 401 request failed - invalid API key provided

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
def1149
 
Posts: 4
Joined: Sat Jul 04, 2015 12:38 pm

$ 401 request failed - invalid API key provided

Post by def1149 »

I'm getting a 401 error trying to post data to a feed using Insomnia

https://io.adafruit.com/api/v2/myuserid ... sture/data

I've changed my API key several times to no avail
What am I doing wrong?

Timeline output from Insomnia


> POST /api/v2/myuserid/feeds/grass-moisture/data HTTP/2
> Host: io.adafruit.com
> user-agent: insomnia/2021.6.0
> cookie: XSRF-TOKEN=vWFjM77vyDoXdk ....
> x-aio-key:: thisismykey
> content-type: application/json
> accept: */*
> content-length: 21
{
"value" : "66.6"
}

* We are completely uploaded and fine

< HTTP/2 401
< server: nginx
< date: Thu, 09 Dec 2021 22:44:04 GMT
< content-type: application/json; charset=utf-8
< x-frame-options: SAMEORIGIN
< x-x.s.s-protection: 1; mode=block <- Your message contains banned spam words. Please rephrase your post without the following words: x-x.s.s-protection ??? periods added to override
< x-content-type-options: nosniff
< x-download-options: noopen
< x-permitted-cross-domain-policies: none
< referrer-policy: strict-origin-when-cross-origin
< x-aio-worker: io-rails-3
< access-control-allow-origin: *
< access-control-allow-credentials: false
< access-control-request-method: *
< access-control-allow-methods: POST, PUT, DELETE, GET, OPTIONS, PATCH
< access-control-allow-headers: DNT, Origin, X-Requested-With, X-AIO-Key, Content-Type, Accept, Authorization
< access-control-expose-headers: X-Pagination-Limit, X-Pagination-Start, X-Pagination-End, X-Pagination-Count, X-Pagination-Total
< access-control-max-age: 1728000
< cache-control: no-cache
< x-request-id: 50e95caf-14da-491d-a5a1-43a819361f9f
< x-runtime: 0.009119
< x-aio-proxy: 2
< strict-transport-security: max-age=31536000
< permissions-policy: interest-cohort=()

User avatar
jwcooper
 
Posts: 1004
Joined: Tue May 01, 2012 9:08 pm

Re: $ 401 request failed - invalid API key provided

Post by jwcooper »

Not sure if this is an issue, but this line is formatted incorrectly with an extra colon:

Code: Select all

> x-aio-key:: thisismykey

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”