I'm trying to use Curl to perform a call with the DUO API.

I tried reviewed their docs here: https://duo.com/docs/adminapi#authentication

The docs says to pass the creds as HMAC key for the request but now sure how to get that going.

This is what I got so far:

curl --request GET \
     --header 'Authorization: Basic 'Integration key:Secret key'' \
     --header "Content-Type: application/x-www-form-urlencoded" \
     "https://api-12345678.duosecurity.com/auth/v2/check"

Which returns

{"code": 40101, "message": "Missing request credentials", "stat": "FAIL"}

Can one point me to the right direction for an example in Bash. If not in Python.


First, your request format does not seem correct, because Integration key:Secret key'' is outside the header (look at the way the syntax is highlighted in the question).

Try:

curl --request GET \
     --header 'Authorization: Basic' \
     --header 'Integration key: Secret key' \
     --header 'Date: Tue, 21 Aug 2012 17:29:18 -0000' \
     --header "Content-Type: application/x-www-form-urlencoded" \
     "https://api-12345678.duosecurity.com/auth/v2/check"

It's somewhat uncommon to have header names with a space and a lowercase like Integration key, so you may need to experiment with variants, like Integration-Key.

Second, the 401xx series errors mean:

401 The “Authorization”, “Date”, and/or “Content-Type” headers were missing or invalid.

You'll need to add the missing the Date header, required by the authenticator.