<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Calling DropboxOAuth2Helper.ProcessCodeFlowAsync syncronously in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Calling-DropboxOAuth2Helper-ProcessCodeFlowAsync-synchronously/m-p/217297#M11336</link>
    <description>&lt;P&gt;What's the best way to make the files available to you, Greg?&lt;/P&gt;</description>
    <pubDate>Fri, 21 Apr 2017 16:13:41 GMT</pubDate>
    <dc:creator>klm1</dc:creator>
    <dc:date>2017-04-21T16:13:41Z</dc:date>
    <item>
      <title>Calling DropboxOAuth2Helper.ProcessCodeFlowAsync synchronously</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Calling-DropboxOAuth2Helper-ProcessCodeFlowAsync-synchronously/m-p/217090#M11307</link>
      <description>&lt;P&gt;From the &lt;A href="https://www.dropbox.com/developers/reference/oauth-guide" target="_self"&gt;OAuth guide&lt;/A&gt;:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"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 need to include a redirect_uri parameter. Dropbox will present the user with an authorization code that they will need to copy and paste into your app, at which point your app can exchange it for a reusable access token."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the situation mentioned above, it appears that the authorization code provided on the Dropbox web page would need to be converted to an access token using (on .NET)&amp;nbsp;DropboxOAuth2Helper.ProcessCodeFlowAsync(). But what if that function needs to be called synchronously? This does not seem to work as task.Wait() never returns:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;var task = DropboxOAuth2Helper.ProcessCodeFlowAsync(authorizationCode, appKey, appSecret);
task.Wait();&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any alternatives for handling the case where browser redirection isn't possible and the access token needs to be aquired synchronously?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:23:29 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Calling-DropboxOAuth2Helper-ProcessCodeFlowAsync-synchronously/m-p/217090#M11307</guid>
      <dc:creator>klm1</dc:creator>
      <dc:date>2019-05-29T09:23:29Z</dc:date>
    </item>
    <item>
      <title>Re: Calling DropboxOAuth2Helper.ProcessCodeFlowAsync syncronously</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Calling-DropboxOAuth2Helper-ProcessCodeFlowAsync-synchronously/m-p/217139#M11318</link>
      <description>&lt;P&gt;That code seems to work for me. Can you elaborate on how you're using it and how you're checking that it never returns?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Alternatively, would await work in your scenario?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;await DropboxOAuth2Helper.ProcessCodeFlowAsync(authorizationCode, appKey, appSecret);&lt;/PRE&gt;</description>
      <pubDate>Thu, 20 Apr 2017 18:38:39 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Calling-DropboxOAuth2Helper-ProcessCodeFlowAsync-synchronously/m-p/217139#M11318</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2017-04-20T18:38:39Z</dc:date>
    </item>
    <item>
      <title>Re: Calling DropboxOAuth2Helper.ProcessCodeFlowAsync syncronously</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Calling-DropboxOAuth2Helper-ProcessCodeFlowAsync-synchronously/m-p/217142#M11319</link>
      <description>&lt;P&gt;Hey Greg,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;        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();
        }&lt;/PRE&gt;&lt;P&gt;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).&lt;BR /&gt;&lt;BR /&gt;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() &lt;img class="lia-deferred-image lia-image-emoji" src="https://www.dropboxforum.com/html/@B0F70D28791EB05FA3EA0C3BDDF08EE3/emoticons/1f61e.png" alt=":disappointed_face:" title=":disappointed_face:" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;        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();
        }&lt;/PRE&gt;&lt;P&gt;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.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Apr 2017 18:58:16 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Calling-DropboxOAuth2Helper-ProcessCodeFlowAsync-synchronously/m-p/217142#M11319</guid>
      <dc:creator>klm1</dc:creator>
      <dc:date>2017-04-20T18:58:16Z</dc:date>
    </item>
    <item>
      <title>Re: Calling DropboxOAuth2Helper.ProcessCodeFlowAsync syncronously</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Calling-DropboxOAuth2Helper-ProcessCodeFlowAsync-synchronously/m-p/217166#M11322</link>
      <description>Yes, please do share that modified version of SimpleTest so we can reproduce this and look into it. Thanks in advance!</description>
      <pubDate>Thu, 20 Apr 2017 21:04:50 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Calling-DropboxOAuth2Helper-ProcessCodeFlowAsync-synchronously/m-p/217166#M11322</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2017-04-20T21:04:50Z</dc:date>
    </item>
    <item>
      <title>Re: Calling DropboxOAuth2Helper.ProcessCodeFlowAsync syncronously</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Calling-DropboxOAuth2Helper-ProcessCodeFlowAsync-synchronously/m-p/217297#M11336</link>
      <description>&lt;P&gt;What's the best way to make the files available to you, Greg?&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2017 16:13:41 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Calling-DropboxOAuth2Helper-ProcessCodeFlowAsync-synchronously/m-p/217297#M11336</guid>
      <dc:creator>klm1</dc:creator>
      <dc:date>2017-04-21T16:13:41Z</dc:date>
    </item>
    <item>
      <title>Re: Calling DropboxOAuth2Helper.ProcessCodeFlowAsync syncronously</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Calling-DropboxOAuth2Helper-ProcessCodeFlowAsync-synchronously/m-p/217313#M11341</link>
      <description>You can post a Dropbox shared link for the project:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://www.dropbox.com/help/167" target="_blank"&gt;https://www.dropbox.com/help/167&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;If you'd prefer to share privately, you can open an API ticket here instead:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://www.dropbox.com/developers/contact" target="_blank"&gt;https://www.dropbox.com/developers/contact&lt;/A&gt;</description>
      <pubDate>Fri, 21 Apr 2017 17:44:12 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Calling-DropboxOAuth2Helper-ProcessCodeFlowAsync-synchronously/m-p/217313#M11341</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2017-04-21T17:44:12Z</dc:date>
    </item>
    <item>
      <title>Re: Calling DropboxOAuth2Helper.ProcessCodeFlowAsync syncronously</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Calling-DropboxOAuth2Helper-ProcessCodeFlowAsync-synchronously/m-p/217350#M11352</link>
      <description>&lt;P&gt;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.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Apr 2017 23:25:56 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Calling-DropboxOAuth2Helper-ProcessCodeFlowAsync-synchronously/m-p/217350#M11352</guid>
      <dc:creator>klm1</dc:creator>
      <dc:date>2017-04-21T23:25:56Z</dc:date>
    </item>
  </channel>
</rss>

