Authentication SAIO (swift all in one) using libCurl API in C++

220 views Asked by At

I'm working to Open Stack in particular to Swift All in One (SAIO). I need to use C++ and libcurl for authentication.

Using curl via terminal I use this command (and it works);

curl -v -H 'X-Auth-User: $SWIFTACCOUNT:$SWIFTUSER' -H 'X-Auth-Key: $SWIFTPASSWORD'

How can I run this command with libcurl in C++?

1

There are 1 answers

0
Daniel Stenberg On BEST ANSWER

Append --libcurl code.c to your command line and you'll get a fine first template to start off from!

CURLOPT_HTTPHEADER is the option to curl_easy_setopt you need.

See also httpcustomheader.c for a full libcurl example using custom HTTP headers.