Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
klm1
9 years agoHelpful | Level 6
Calling DropboxOAuth2Helper.ProcessCodeFlowAsync synchronously
From the OAuth guide:
"Note that for certain apps, such as command line and desktop apps, it's not possible for a web browser to redirect back to your app. In these cases, your app does not nee...
- 9 years ago
For anyone reading this topic, the good folks at Dropbox were able to identify the problem and fix it in version 4.2.5 of the SDK.
Greg-DB
Dropbox Community Moderator
9 years agoThat code seems to work for me. Can you elaborate on how you're using it and how you're checking that it never returns?
Alternatively, would await work in your scenario?
await DropboxOAuth2Helper.ProcessCodeFlowAsync(authorizationCode, appKey, appSecret);
- klm19 years agoHelpful | Level 6
Hey Greg,
Normally (for asynchronous), you'd do something like this (basically changing the SimpleTest sample to allow inputing the authorization code into a text field, then converting that to an access token:
private async void OkClick(object sender, RoutedEventArgs e) { if (this.authorizationCode.Text == String.Empty) this.Close(); OAuth2Response response = await DropboxOAuth2Helper.ProcessCodeFlowAsync(authorizationCode.Text, appKey, appSecret); this.AccessToken = response.AccessToken; this.Uid = response.Uid; this.Result = true; this.Close(); }That works fine and is ok as long as the function, OkClick in this simple example, can can be called asynchronously. (In our real use case, C++/CLI is the caller, and it doesn't know anything about async / await).
I tried doing this instead, which seems to work for most of the Dropbox .NET API calls (note the async and await are gone, but we wait for the task to complete using task.Wait() ):private void OkClick(object sender, RoutedEventArgs e) { if (this.authorizationCode.Text == String.Empty) this.Close(); var task = DropboxOAuth2Helper.ProcessCodeFlowAsync(authorizationCode.Text, appKey, appSecret); task.Wait(); this.AccessToken = task.Result.AccessToken; this.Uid = task.Result.Uid; this.Result = true; this.Close(); }If I step through the code, I never see the line executed after task.Wait(). Am happy to send you the source too, it's basically just a modified version of SimpleTest.
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!