0

I'm building Git client in MFC Framework, and I am using casablanca library in order to make connections with github server and make an usage of its API. In tutorial for Github one example shows how to send a request to github server with user name and password attached for the purposes of authentication:
https://developer.github.com/v3/#authentication

curl -i https://api.github.com -u valid_username:valid_password  

Now, I've tried and tried to achieve the same effect with casablanca from Microsoft but I simply cannot get the syntax right:

http_client client(U("https://api.github.com/users/myuser"));
uri_builder builder(U("- u myuser:mypass"));
pplx::task<http_response> requestTask = client.request(methods::GET, builder.to_string());  

After calling this I'm getting exception thrown from casablanca saying that the uri is not valid.
Any idea how to properly construct request in casablanca so I can send it to github server?
Thank you.

There is nothing we can do
  • 23,727
  • 30
  • 106
  • 194

1 Answers1

0

In the example on the GitHub page, -u username:password is an option to curl:

-u/--user <user:password> 

    Specify the user name and password to use for server authentication.

You can perform basic authentication with the C++ REST SDK using http_client_config::set_credentials().

(Also, see the related question: Set Basic HTTP Authentication in Casablanca)

Community
  • 1
  • 1
roschuma
  • 536
  • 4
  • 7