cancel
Showing results for 
Search instead for 
Did you mean: 

API Authentication in Insomnia

API Authentication in Insomnia

Byron_Morales
New Contributor II
Hi Guys,

I'm trying to use insomnia to use XCC api but I keep getting 401 unauthorized error.

I have the authentication set to Bearer but I'm not sure what to put in for the token or prefix.

I create an API key for the admin user in XCC and pasted that into the token field but that doesn't work.
3 REPLIES 3

Miguel-Angel_RO
Valued Contributor II
Hi Byron,
Here the way to chain requests in Insomnia.
Regards

Mig

Gareth_Mitchell
Extreme Employee
Hi Byron

First you must do a POST and send username/password to the controller which asks the controller to generate a time-limited token for you, once you have this token (a very long string) you copy/paste that into the token value in the bearer, the token is used to authenticate future REST API calls, see below:

652ed8d6a47a4afcb6065b96d07fdd49.png
HTH 

-Gareth

Hi Gareth,

Thanks for getting back to me. I was able to figure out by using curl to send the post and passing the json file with my credentials, but I was wondering how to do the same in insomnia which I now understand from your screenshot. I played around with adding APs in bulk to XCC and it worked out great. I'm really loving the flexibility this is going to create as I dive deeper into the API's available and how I manage our end customers. 

I have a question on the reauth token though. I was able to send the POST using the reauth token and saw that I get a new token and new reauth token, but is there a way to make make the token persistent or not expire? I'm wondering how I'm supposed to update the authentication token if I want to run API's calls on a schedule.
GTM-P2G8KFN