cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
646
Views
0
Helpful
3
Replies

HttpClient Authorization header

Hello,

I'm trying to control an IP power bar using CLI HttpClient Post commands and am getting "401 Unauthorized" returns from the device.  These commands are working fine via Postman, which leads me to believe something isn't right with the headers being sent from the codec. I've used 3 different codecs (RoomKit Plus, RoomKit Pro, RoomBar), as well as 3 different IP power bars with the same result. I've also connected a TV tuner which doesn't require the Authorization header, and it works as expected.

 

CLI command being sent:

xCommand HTTPClient Post AllowInsecureHTTPS:true Header: “Authorization: Basic YWRtaW46YWRtaW4=” Header: “Content-Length: 24” Header: “Content-Type: application/x-www-form-urlencoded” URL: “http://<redacted>/outletsubmit.htm

controlnum=2&command=OFF

.

 

In the HTTPClient configureation page: AllowHTTP=true; AllowInsecureHTTPS=True; Mode=On; Proxy=Off.

 

I've attached the relevant section from log file.

 

Wondering if anyone has any ideas...?

 

Thanks

3 Replies 3

Hi @scoobydoobydoooo,

Did you get any further with the Dev Supportteam? If so, can you share the outcome? I'm also interested in using xAPI command httpclient with Authorization.

Thanks.

Yes, I got it working.

The problem turned out to be the codec adding a <space> within the authorization header.

Header: “Authorization: Basic YWRtaW46YWRtaW4=”  was actually sending "Authorization:<space><space>Basic YWRtaW46YWRtaW4=”  and causing the 401 unauthorized error.

 

The solution was to remove the <space> after the colon

Header: “Authorization:Basic YWRtaW46YWRtaW4=”  sends the command as expected with only one <space>.

 

 

sandiban
Cisco Employee
Cisco Employee

Hi @scoobydoobydoooo,
Thanks for sharing the details!
We appreciate the thorough background on this request provided.
However, I'd say this is not the great place to discuss this item, because we might have to check with the Device xAPI team to check the error log and probably needed multiple follow-ups in future.
So, may I ask you to share the details to devsupport@webex.com and once you send the email with the attachment, it'd create a case in our Zendesk Ticket platform support queue.

That way it'd be much better to track this case and make further progress on it.
Kindly do the needful.

Regards!
Sandip