Your workflow is unique 👨💻 - tell us how you use Dropbox here.
Forum Discussion
kdss-ja
3 years agoExplorer | Level 3
Trying to get token to work or set expiration date to long time
I've copied the example code in SimpleTest and got access token working but expires after short time
I've just want very simple way to write and read files from my drop box programmatically. (and s...
kdss-ja
3 years agoExplorer | Level 3
Thanks trying to get the basic example working
Invalid redirect_uri. It must exactly match one of the redirect URIs you've pre-configured for your app (including the path).
I've added these paths to the App
Redirect URIs
Any help much appreciated
kdss-ja
3 years agoExplorer | Level 3
After continuous effort, changed 127.0.0.1 to localhost to get it redirect working.
Next Issue:
still can get this to work, thanks in advance!
//give all scope
string[] scopeList = new string[6] { "files.metadata.read", "files.content.read", "account_info.read", "files.metadata.write", "files.content.write", "file_requests.write" };
//succesfully acquire tokens
var uid = await this.AcquireAccessToken(scopeList, IncludeGrantedScopes.None);
HttpClient httpClient = new HttpClient();
try
{
var config = new DropboxClientConfig("ArgusCE")
{
HttpClient = httpClient
};
Console.WriteLine("Attempting to try again with include_granted_scopes");
await this.AcquireAccessToken(scopeList, IncludeGrantedScopes.User);
client = new DropboxClient(AccessToken, ApiKey, ApiSecret, config); //note accesstoken was acquired successfully
//create new dropbox client but when call
await client.Files.ListFolderAsync(Path);
also calling var full = await client.Users.GetCurrentAccountAsync(); fails?
throws exception
Response status code does not indicate success: 400 (Bad Request).
- kdss-ja3 years agoExplorer | Level 3
Narrowing it down
//Client = new DropboxClient(AccessToken, ApiKey, ApiSecret, config); //this doesn't work throws exception
Client = new DropboxClient(AccessToken, config); //this worksQuestion will this AccessToken last for long time?
- Здравко3 years agoLegendary | Level 20
kdss-ja wrote:...
Question will this AccessToken last for long time?
Hi kdss-ja,
If as long time, you mean 4 hours or so - Yes, otherwise - No. Doesn't matter how you gonna get your access token, it's always short lived.
Read with some more care Greg's comments above! The Dropbox client object can manage the access token refresh for you. To be possible, you need to pass the refresh token too (for use in the refresh process), otherwise once the passed access token expired exception gonna be thrown. More precise directions how you can construct client objects can be seen here (non PKCE) and here (PKCE). Note that parameters don't exclude the refresh token there, as you are doing. Actually the access token can be removed everywhere (if suitable).
Hope this sheds additional light.
- kdss-ja3 years agoExplorer | Level 3
Ok thanks I was just trying to follow the basic sample.
I would suggest you update the samples to make them work, reading the doco is confusing.
But this does work (again remove the other constructors or get them to throw appropriate exceptions)
new DropboxClient(AccessToken, RefreshToken, ApiKey, ApiSecret, config);
I'm only using drop box as simple way to share files between people (having trouble with the simple)
About Dropbox API Support and Feedback
Get help with the Dropbox API from fellow developers and experts.
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!