<?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: Problem and 2 possible solutions for Cordova-PhoneGap OAuth in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Problem-and-2-possible-solutions-for-Cordova-PhoneGap-OAuth/m-p/197047#M9067</link>
    <description>&lt;P&gt;You might want to take a look at&amp;nbsp;&lt;A href="https://github.com/dropbox/dropbox-js/blob/0af3014a14771f951d533d812001efb04bf68978/src/auth_driver/cordova.coffee" target="_blank"&gt;https://github.com/dropbox/dropbox-js/blob/0af3014a14771f951d533d812001efb04bf68978/src/auth_driver/cordova.coffee&lt;/A&gt;. That's from the old deprecated JS SDK, but&amp;nbsp;it hopefully shows the pattern for&amp;nbsp;using Cordova's InAppBrowser control.&lt;/P&gt;</description>
    <pubDate>Thu, 08 Dec 2016 21:06:22 GMT</pubDate>
    <dc:creator>Steve M.</dc:creator>
    <dc:date>2016-12-08T21:06:22Z</dc:date>
    <item>
      <title>Problem and 2 possible solutions for Cordova-PhoneGap OAuth</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Problem-and-2-possible-solutions-for-Cordova-PhoneGap-OAuth/m-p/196320#M8990</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem with&amp;nbsp;&lt;SPAN&gt;Cordova / PhoneGap is that is isn't really a browser nor is it a server and to get a user oauth-authenticated requires browsing to the dropbox choser url. &amp;nbsp;So, a dropbox app must initiate an external browser (a browser on the device, but outside of phonegap, so no cross communication is possible). &amp;nbsp;The problem is that oauth authentication requires a redirect-url. &amp;nbsp;However, there is no simple redirect-url that dropbox can go back to since PhoneGap isn't a browser nor a server (ie, has no url to get back to).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Two possible solutions to this problem. One could possibly use a &lt;U&gt;localhost&lt;/U&gt;&amp;nbsp;redirect-url &amp;nbsp;and setup a static set of html files on the mobile device. &amp;nbsp;These static html files (outside of cordova) could store the access key somewhere that cordova app could pick up later. &amp;nbsp;However, this is getting increasing difficult for phonegap applications are being sandboxed, and these static files don't live in the same domain as the as the cordova app. (They live in the localhost domain not the named app domain)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The other solution, which I took, was to have the url-redirect go to a know internet surrogate-server. &amp;nbsp;I pass a "state" parameter in the choser request with a &lt;U&gt;unique-guid&lt;/U&gt;. &amp;nbsp;The &amp;nbsp;surrogate server simple saves the granted access key under the &lt;U&gt;unique-guid&lt;/U&gt;. &amp;nbsp;The Phone Gap application in the mean time is simply waiting for the user to be done with the external browser. &amp;nbsp;When done, the phonegap makes an ajax call to the&amp;nbsp;surrogate-server passing the &lt;U&gt;unique-guid&lt;/U&gt;, and getting the access key back in return.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Both of these solutions seam rather complicated, but I've gotten the second solution to work. &amp;nbsp;My question is, does&amp;nbsp;anybody have a better answer?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks, Randy.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:27:55 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Problem-and-2-possible-solutions-for-Cordova-PhoneGap-OAuth/m-p/196320#M8990</guid>
      <dc:creator>randynwalsh</dc:creator>
      <dc:date>2019-05-29T09:27:55Z</dc:date>
    </item>
    <item>
      <title>Re: Problem and 2 possible solutions for Cordova-PhoneGap OAuth</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Problem-and-2-possible-solutions-for-Cordova-PhoneGap-OAuth/m-p/196566#M9002</link>
      <description>Thanks for the post Randy! I'm not too familiar with Cordova/PhoneGap, and this is a bit outside the scope of Dropbox support, so I'm afraid I can't be of much help myself, but hopefully someone else here can chime in.&lt;BR /&gt;&lt;BR /&gt;One thing I can note though, is that another possible (albeit non-ideal) solution is to use the "code" flow without specifying a redirect URI, in which case the user would need to copy and paste the authorization code from the Dropbox web site into your app:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://www.dropbox.com/developers/documentation/http/documentation#authorization" target="_blank"&gt;https://www.dropbox.com/developers/documentation/http/documentation#authorization&lt;/A&gt;</description>
      <pubDate>Mon, 05 Dec 2016 19:01:54 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Problem-and-2-possible-solutions-for-Cordova-PhoneGap-OAuth/m-p/196566#M9002</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2016-12-05T19:01:54Z</dc:date>
    </item>
    <item>
      <title>Re: Problem and 2 possible solutions for Cordova-PhoneGap OAuth</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Problem-and-2-possible-solutions-for-Cordova-PhoneGap-OAuth/m-p/197047#M9067</link>
      <description>&lt;P&gt;You might want to take a look at&amp;nbsp;&lt;A href="https://github.com/dropbox/dropbox-js/blob/0af3014a14771f951d533d812001efb04bf68978/src/auth_driver/cordova.coffee" target="_blank"&gt;https://github.com/dropbox/dropbox-js/blob/0af3014a14771f951d533d812001efb04bf68978/src/auth_driver/cordova.coffee&lt;/A&gt;. That's from the old deprecated JS SDK, but&amp;nbsp;it hopefully shows the pattern for&amp;nbsp;using Cordova's InAppBrowser control.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2016 21:06:22 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Problem-and-2-possible-solutions-for-Cordova-PhoneGap-OAuth/m-p/197047#M9067</guid>
      <dc:creator>Steve M.</dc:creator>
      <dc:date>2016-12-08T21:06:22Z</dc:date>
    </item>
  </channel>
</rss>

