2

I am trying to get the request token from Dropbox.

Till now I have tried countless libraries, some don't work, some are not maintained, and some simply you don't know what to do. So I think it'll be easier for me to make my own functions by using OAuth and PHP.

I have collected some knowledge from a few places and created this:

<?php
$consumer = new OAuth("Key", "Secret", OAUTH_SIG_METHOD_HMACSHA1, OAUTH_AUTH_TYPE_FORM);

$consumer->fetch('https://api.dropbox.com/1/oauth/request_token', null, OAUTH_HTTP_METHOD_POST);

?>

And it seems to work.

Now my questions are:

  1. I want to know how do I get the stuff they have sent in return, i.e. the Request Token?
  2. And will I be able to use this method for other things too, like getting Access Tokens and more?

Note: I'm on Ubuntu 12.04 with the OAuth PHP5 Library installed using PECL.

hakre
  • 193,403
  • 52
  • 435
  • 836
Arjun Bajaj
  • 1,932
  • 7
  • 24
  • 41
  • Even if you don't want to use it (which I hope you would, I'm the maintainer), you could "borrow" code from https://github.com/Dropbox-PHP/dropbox-php Specifically, look at the code in the Unit tests for how to establish the Oauth connection as well as examples for using the library. – Joe Constant Mar 10 '12 at 00:13

2 Answers2

0

If you're looking for a simplified explanation of OAuth in Dropbox, look at this code:

https://github.com/hawaiianchimp/Dropbox-PHP-API/

If you follow the comments and the example, you should get a good understanding of OAuth.

seantomburke
  • 10,514
  • 3
  • 18
  • 23
0
  1. The returned values are formatted in JSON in the response to the call, as seen in the docs: https://www.dropbox.com/developers/reference/api
  2. Yes, all calls (with the exception of /authorize which isn't exactly an API call) need to be signed like this.
Greg
  • 16,359
  • 2
  • 34
  • 44