-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use getRefreshedAccessToken ? #200
Comments
Hello @Clemweb, this example script will return a URL where you have to login with the account you want to authenticate in the application, when you login it will give you a one-time auth key, but im using this fork https://github.com/internacionalweb/dropbox-php-sdk Example: use Kunnu\Dropbox\Dropbox;
use Kunnu\Dropbox\DropboxApp;
use Kunnu\Dropbox\Authentication\DropboxAuthHelper;
$appKey = 'YOUR_APP_KEY';
$appSecret = 'YOUR_APP_SECRET';
$authToken = 'YOUR_APP_AUTH_TOKEN';
$app = new DropboxApp($appKey, $appSecret, $authToken);
$dropboxClient = new Dropbox($app);
$authHelper = $dropboxClient->getAuthHelper();
$authHelper->setAccessTokenType(DropboxAuthHelper::TOKEN_ACCESS_TYPE_OFFLINE);
echo 'AUTH URL: ' . $authHelper->getAuthUrl(); With that key use $authHelper->getAccessToken('YOUR_AUTH_KEY') It will return an AccessToken object in which we can find the refresh_token. This is a permanent token with which we can generate Short Live tokens for a duration of 4 hours. Example: use Kunnu\Dropbox\Dropbox;
use Kunnu\Dropbox\DropboxApp;
$appKey = 'YOUR_APP_KEY';
$appSecret = 'YOUR_APP_SECRET';
$authToken = 'YOUR_APP_AUTH_TOKEN';
$app = new DropboxApp($appKey, $appSecret, $authToken);
$dropboxClient = new Dropbox($app);
$authHelper = $dropboxClient->getAuthHelper();
var_dump($authHelper->getAccessToken('YOUR_AUTH_KEY')); I hope this helps 👍 |
That function does not exists Fatal error: Uncaught Error: Call to undefined method Kunnu\Dropbox\Authentication\DropboxAuthHelper::setAccessTokenType() |
@Pixelao what version are you using? |
I'm using a fork, which introduces new functionality for working with short-lived tokens. |
Hello,
I need to share specifics docs from my Dropbox to end user.
All is ok to get and use the AccessToken from my back office. But the token expire like mentioned in doc, so I need to refresh token for my front office users.
How use getRefreshedAccessToken ??
The documentation is very poor and not clear: why passed $accessToken to it ?
Somebody can share me a full example ?
Thanks
The text was updated successfully, but these errors were encountered: