I keep getting issues with dropbox php api, i am just trying to get it to work using getmeta. but i keep getting the following error??
I think the issues is here.
public function getToken($email, $password) {
throw new Dropbox_Exception('This API method is deprecated as of the version 1 API');
}
here is my code.
$consumerKey = 'oksergerg1x1r';
$consumerSecret = 'zexb0rg6h54tgzzb';
require($_SERVER['DOCUMENT_ROOT'] . '/wp/includes/Dropbox/autoload.php');
//session_start();
$oauth = new Dropbox_OAuth_Wordpress($consumerKey, $consumerSecret);
echo "<pre>";
print_r($oauth);
echo "</pre>";
// If the PHP OAuth extension is not available, you can try
// PEAR's HTTP_OAUTH instead.
// $oauth = new Dropbox_OAuth_PEAR($consumerKey, $consumerSecret);
$dropbox = new Dropbox_API($oauth);
$tokens = $dropbox->getToken('[email protected]', 'secretpassword');
// You are recommended to save these tokens, note that you don't
// need to save the username and password, so just ask your user the
// first time and then destroy them.
echo "Tokens:\n";
print_r($tokens);
so i says that the getToken function has depreciated so what are we supposed to use instead??
UPDATE
Ok sorry googled abit and i see that the new version does not support getTokens anymore even though they are in the examples still for some reason.
So i am confused now.
I am trying to setup an app so people can enter their dropbox email and password. Then it will pull all their metadata in from their account.
With the new code how do i give a user access? if their is no email and password how do i get their correct tokens???
Sorry i am really confused with this now been working for the past two days trying to suss this.
Take a look at the Unit tests. They should be considered more up-to-date examples for how to use the library. Dropbox deprecated some of the authentication stuff in the latest version of the API, that's why we had to deprecate it in the library. It's on my list to update the documentation and examples, I've just been really busy.
Basically, you need to do the following:
On your Oauth provider class, call:
$tokens = $oauth->getRequestToken();
Then redirect the user to
$oauth->getAuthorizeUrl()
so they can authenticate with Dropbox and approve your access.Finally, call:
You can store
$tokens
somewhere for future use in connecting. Which you will use by calling:Hope that helps. There is more you can do (such as providing a callback URL for Dropbox to redirect the user back to). Just check the APITests.php file and the setup file in the tests directory of the source: https://github.com/Dropbox-PHP/dropbox-php/tree/master/tests