REST API Token Authentication with cURL

Posted on
Tue Apr 05, 2022 12:36 pm
redxtech offline
Posts: 2
Joined: Apr 04, 2022

REST API Token Authentication with cURL

Hey! My dad runs an indigo setup at home, but since I don't have any devices using iOS, I am unable to interact with it normally. I would like to have his system integrated into my own smart setup, so I looked into the REST API, which looks like it should do the job.

I generated an API token for the server, and tried to use cURL to access it, but I'm not able to get it to work.

The command that I am running is
Code: Select all
curl -H "Authorization: Bearer $INDIGO_TOKEN" https://my-reflector.indigodomo.net/devices.json
, and I am receiving an HTML response with "You are not authorized to access that resource". I made sure that the API key was generated for the correct server, and that I had the correct endpoint and API key. Both are correct.

HTTP Basic authentication isn't working either (http://user:pass@my-reflector.indigodomo.net), but using digest I was able to get it to work. However, I would much prefer being able to use the API key, as that's best practices for API access and I also don't want to store the plaintext username & password on my computer & smart home server.

Is there something I need to do to enable access with the API token? I tried rebooting the server after generating the key, but nothing changed.

Thanks!

Posted on
Tue Apr 05, 2022 1:08 pm
jay (support) offline
Site Admin
User avatar
Posts: 18212
Joined: Mar 19, 2008
Location: Austin, Texas

Re: REST API Token Authentication with cURL

Is OAuth/Key authentication enabled in the Start Local Server dialog for his Indigo Server?

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Apr 05, 2022 8:22 pm
redxtech offline
Posts: 2
Joined: Apr 04, 2022

Re: REST API Token Authentication with cURL

jay (support) wrote:
Is OAuth/Key authentication enabled in the Start Local Server dialog for his Indigo Server?


Turns out the entries in the authourizations interface were backwards! The entry for server 1 is actually for server 2, and the entry for server 2 is actually for server 1! I'm pretty sure my dad mentioned that he messed this up when setting everything up and just hasn't had time to go and fix it, especially since everything still works just fine.

I swapped the API keys around and they both work just fine. I did have to upgrade server 1 from 7.4 to 2021.2 though, but that was expected.

Thanks!

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest