DUO API : 401, ReasonPhrase: 'Unauthorized' using HTTPClient in POST


#1

DUO Community-

When trying to access the DUO API to get the DUO User Info using HTTPClient in POST.
https://****.com/admin/v1/users , getting Error : 401, ReasonPhrase: ‘Unauthorized’

But its working fine when using GET by passing userid in query string
https://*******.com/admin/v1/users?username=testuser

Please advise

Thanks
Samy


#2

Hey there Samy,

You POST to make a change, or GET to retrieve information. You wouldn’t POST to retrieve information (implied by the statement “to get the DUO User Info using HTTPClient in POST”).

Compare these GET operations: Retrieve Users, Retrieve Groups to these POST operations: Create User. Create Group.

So, a GET on /admin/v1/users would return the full list of Duo users, but a POST on /admin/v1/users won’t do anything.

Just wanted to clarify what action you are trying to perform in the POST.


#3

Thanks so much for the reply.

Yes, I used POST to retrieve the Info. I will check these methods and get back to you.

Thanks

Samy


#4

Hi-

GET is working fine, able to Retrieve the User.

But POST / DELETE ,not working, getting ‘UnAuthorized’ Error. This issue is there in HTTPClient. But the same data working fine in WebClient.

please let me know if you need any other details

Thanks

Samy


#5

I’m not sure why you are receiving an error and frankly I don’t understand what you are trying to do via POST. Can you provide an example?


#6

Thanks-

Never mind. I found the issue and fixed it.

Auth Key data was not correct.

Thanks again for your support.

-Samy