10

I'm trying to use the libcurl in a C/C++ application to post files to DropBox.

I would like to use the "/files (POST)" API as documented here...

https://www.dropbox.com/developers/reference/api#files-POST

I am having problems with properly authenticating (OAuth) this call. It is unclear to me how to properly create the authentication signature.

From some a sample I saw, it looked like they were reading in the whole file to create the HMAC-SHA1 encoding on. This seems problematic on large files.

Does anyone have experience or insight using this API or something similar?

Bob Brown
  • 121
  • 1
  • 7
  • 1
    +1 Can't help you, But awesome idea! Are you doing a project? Is it open-source? – ApprenticeHacker Dec 14 '11 at 08:09
  • Looking at the Oauth api, you formulate an HTTP request, then generate a "Signature Base String" with that, and then use HMAC-SHA1 on that string to generate the signature. See Appendix A.5.1 on http://oauth.net/core/1.0/ – Brad Dec 16 '11 at 06:18
  • @Bob Brown Hi have you successfully implemented files-POST with C++? im trying so hard to get this work.. hopefully you can help out. – mister Dec 19 '12 at 19:38

2 Answers2

1

I have just use the libouth and libcurl to get information from sina weibo. here is my example for you refer. you can also refer the liboauth test programmer in the tests dir, oauthtest.c

    if (use_post)
    {
        req_url = oauth_sign_url2(test_call_uri, &postarg, OA_HMAC, NULL, c_key, c_secret, t_key, t_secret);
        reply = oauth_http_post(req_url,postarg);
    } 
CodyZhang
  • 11
  • 1
0

I suggest using BOOST ASIO . Makes uploading and downloading a breeze.

MistyD
  • 16,373
  • 40
  • 138
  • 240