We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
divyesh
5 years agoExplorer | Level 4
Re: Oauth2 refresh token question - what happens when the refresh token expires?
When I'm trying to fetch short-lived access token I'm getting this error
Client error: `POST https://api.dropbox.com/oauth2/token` resulted in a 400 Bad Request response: {"error_description":...
Greg-DB
Dropbox Community Moderator
5 years agoThe access token you posted, which starts with "sl.", is a Dropbox OAuth 2 access token. Note that you should never post these publicly though, so please refrain from doing so in the future.
The "sl." prefix indicates that this particular access token is a "short-lived" access token, meaning that it was only valid for four hours, after which it can no longer be used to successfully perform Dropbox API calls. When a short-lived access token like this expires, if you need to make further calls, you would need to get a new one. You would do so either by using a refresh token, or by processing the OAuth app authorization flow again. I recommend reading the OAuth Guide and authorization documentation for more information.
Also, the "token/from_oauth1" route in particular you linked to is only meant for use with old OAuth 1 access tokens, retrieved from the old retired Dropbox API v1. If you do not have old OAuth 1 access tokens stored that you need to migrate, you should not use that route. If you are just developing your integration now, you would not have any OAuth 1 access tokens.
divyesh
5 years agoExplorer | Level 4
Yes I followed the same oauth process and i found the token starting with sl.<token> but i'm getting this error using that token
Server error: `POST https://api.dropboxapi.com/2/files/search_v2` resulted in a `500 Internal Server Error` response: unexpected error occurred
- Greg-DB5 years ago
Dropbox Community Moderator
A 500 error like that should indicate an issue on the Dropbox servers. If you're still seeing this issue, please share the code/steps to reproduce that, as well as several sample 'X-Dropbox-Request-Id' response header values. That should help us investigate. (Be sure to redact your access token though.) Thanks!
- divyesh5 years agoExplorer | Level 4
Here is my code
env('DROPBOX_TOKEN') is access token sl.<access token>
$this->client = new Client(env('DROPBOX_TOKEN'));
$this->adapter = new DropboxAdapter($this->client);$checkFolderAvailable = $this->client->search('test');
in this search function i'm getting 500 error
- Greg-DB5 years ago
Dropbox Community Moderator
Thanks, can you share several sample 'X-Dropbox-Request-Id' response header values though?
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!