<?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: SwiftyDropbox (v0.2) - invalid_access_token in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/SwiftyDropbox-v0-2-invalid-access-token/m-p/39555#M1236</link>
    <description>&lt;P&gt;Thanks. Yes I am calling &lt;CODE&gt;Dropbox.handleRedirectURL(url)&lt;/CODE&gt; in my app delegate.&lt;/P&gt;</description>
    <pubDate>Thu, 18 Jun 2015 00:16:06 GMT</pubDate>
    <dc:creator>Peter M.107</dc:creator>
    <dc:date>2015-06-18T00:16:06Z</dc:date>
    <item>
      <title>SwiftyDropbox (v0.2) - invalid_access_token</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/SwiftyDropbox-v0-2-invalid-access-token/m-p/39546#M1227</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I'm trying out SwiftyDropbox and following the code given in the blogpost (&lt;A href="https://blogs.dropbox.com/developers/2015/05/try-out-swiftydropbox-the-new-swift-sdk-for-dropbox-api-v2/" rel="nofollow noreferrer" target="_blank"&gt;https://blogs.dropbox.com/developers/2015/05/try-out-swiftydropbox-the-new-swift-sdk-for-dropbox-api-v2/&lt;/A&gt;).&lt;/P&gt;

&lt;P&gt;When I try and do something (e.g. &lt;CODE&gt;client.usersGetCurrentAccount()&lt;/CODE&gt;) I get an HTTP error: &lt;CODE&gt;invalid_access_token&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Any help would be appreciated.&lt;/P&gt;

&lt;P&gt;-Peter&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:42:08 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/SwiftyDropbox-v0-2-invalid-access-token/m-p/39546#M1227</guid>
      <dc:creator>Peter M.107</dc:creator>
      <dc:date>2019-05-29T09:42:08Z</dc:date>
    </item>
    <item>
      <title>Re: SwiftyDropbox (v0.2) - invalid_access_token</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/SwiftyDropbox-v0-2-invalid-access-token/m-p/39547#M1228</link>
      <description>&lt;P&gt;Moved to API forum.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2015 09:24:32 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/SwiftyDropbox-v0-2-invalid-access-token/m-p/39547#M1228</guid>
      <dc:creator>Rich</dc:creator>
      <dc:date>2015-06-12T09:24:32Z</dc:date>
    </item>
    <item>
      <title>Re: SwiftyDropbox (v0.2) - invalid_access_token</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/SwiftyDropbox-v0-2-invalid-access-token/m-p/39548#M1229</link>
      <description>&lt;P&gt;Are you sure the user has completed the auth flow? Maybe check that you have a valid access token with &lt;CODE&gt;DropboxAuthManager.sharedAuthManager.hasStoredAccessTokens()&lt;/CODE&gt; or by printing &lt;CODE&gt;DropboxAuthManager.sharedAuthManager.getAllAccessTokens()&lt;/CODE&gt;?&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2015 11:16:05 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/SwiftyDropbox-v0-2-invalid-access-token/m-p/39548#M1229</guid>
      <dc:creator>Leah C.1</dc:creator>
      <dc:date>2015-06-12T11:16:05Z</dc:date>
    </item>
    <item>
      <title>Re: SwiftyDropbox (v0.2) - invalid_access_token</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/SwiftyDropbox-v0-2-invalid-access-token/m-p/39549#M1230</link>
      <description>&lt;P&gt;Thanks Leah. Yes the user has completed the auth flow. &lt;BR /&gt;
DropboxAuthManager.sharedAuthManager.hasStoredAccessTokens() is true&lt;BR /&gt;
And DropboxAuthManager.sharedAuthManager.getAllAccessTokens() contains my token.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2015 11:25:43 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/SwiftyDropbox-v0-2-invalid-access-token/m-p/39549#M1230</guid>
      <dc:creator>Peter M.107</dc:creator>
      <dc:date>2015-06-12T11:25:43Z</dc:date>
    </item>
    <item>
      <title>Re: SwiftyDropbox (v0.2) - invalid_access_token</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/SwiftyDropbox-v0-2-invalid-access-token/m-p/39550#M1231</link>
      <description>&lt;P&gt;Hmmm... this could also happen if the access token has been revoked. Maybe try &lt;CODE&gt;Dropbox.unlinkClient()&lt;/CODE&gt; and re-authorizing?&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2015 11:34:06 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/SwiftyDropbox-v0-2-invalid-access-token/m-p/39550#M1231</guid>
      <dc:creator>Leah C.1</dc:creator>
      <dc:date>2015-06-12T11:34:06Z</dc:date>
    </item>
    <item>
      <title>Re: SwiftyDropbox (v0.2) - invalid_access_token</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/SwiftyDropbox-v0-2-invalid-access-token/m-p/39551#M1232</link>
      <description>&lt;P&gt;That worked. Is there any way to guard/check for a revoked token?&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2015 11:41:34 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/SwiftyDropbox-v0-2-invalid-access-token/m-p/39551#M1232</guid>
      <dc:creator>Peter M.107</dc:creator>
      <dc:date>2015-06-12T11:41:34Z</dc:date>
    </item>
    <item>
      <title>Re: SwiftyDropbox (v0.2) - invalid_access_token</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/SwiftyDropbox-v0-2-invalid-access-token/m-p/39552#M1233</link>
      <description>&lt;P&gt;There's no way to know if a token has been revoked until you make an API call. You'll need to look for a 401 error response and then call &lt;CODE&gt;Dropbox.unlinkClient()&lt;/CODE&gt; to clear the bad tokens.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2015 12:13:00 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/SwiftyDropbox-v0-2-invalid-access-token/m-p/39552#M1233</guid>
      <dc:creator>Leah C.1</dc:creator>
      <dc:date>2015-06-12T12:13:00Z</dc:date>
    </item>
    <item>
      <title>Re: SwiftyDropbox (v0.2) - invalid_access_token</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/SwiftyDropbox-v0-2-invalid-access-token/m-p/39553#M1234</link>
      <description>&lt;P&gt;Hi Leah,&lt;BR /&gt;
I am just following up on this again as I've had a couple of issues along the way. The main issue I've had is not being able to call Dropbox after auth. It happens if it's the first time I auth or if I call &lt;CODE&gt;Dropbox.unlinkClient()&lt;/CODE&gt; then re-auth. The problem seems to be the same - &lt;CODE&gt;Dropbox.authorizedClient&lt;/CODE&gt; and &lt;CODE&gt;DropboxClient.sharedClient&lt;/CODE&gt; are &lt;CODE&gt;nil&lt;/CODE&gt;.&lt;BR /&gt;
I also didn't like that the 401 was embedded in the error string. I added an extension to make the http code more easily accessible and to handle the unlinking. I've ended up wrapping SwiftyDropbox (&lt;A href="https://gist.github.com/p15martin/82cbae8188729f26fbbb" rel="nofollow noreferrer"&gt;https://gist.github.com/p15martin/82cbae8188729f26fbbb&lt;/A&gt;).&lt;BR /&gt;
Interested in your thoughts?&lt;BR /&gt;
-Peter&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jun 2015 09:55:28 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/SwiftyDropbox-v0-2-invalid-access-token/m-p/39553#M1234</guid>
      <dc:creator>Peter M.107</dc:creator>
      <dc:date>2015-06-17T09:55:28Z</dc:date>
    </item>
    <item>
      <title>Re: SwiftyDropbox (v0.2) - invalid_access_token</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/SwiftyDropbox-v0-2-invalid-access-token/m-p/39554#M1235</link>
      <description>&lt;P&gt;Just to clarify, Dropbox a user is authorized by clicking a link in your app which calls &lt;CODE&gt;Dropbox.authorizeFromController(controller)&lt;/CODE&gt;. This presents a web view for the user to login and afterwards, you're calling &lt;CODE&gt;Dropbox.handleRedirectURL(url)&lt;/CODE&gt; which handles storing the access token for the user. There's no need to set or get access tokens manually - just be sure to call &lt;CODE&gt;Dropbox.handleRedirectURL(url)&lt;/CODE&gt; in your AppDelegate's &lt;CODE&gt;&lt;BR /&gt;
- application:openURL:sourceApplication:annotation:&lt;/CODE&gt; method (this isn't shown in your gist but I'm assuming you're doing this??). Does that help clear things up?&lt;/P&gt;

&lt;P&gt;I'll pass along the feedback about the error object to the team. Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 17 Jun 2015 23:43:12 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/SwiftyDropbox-v0-2-invalid-access-token/m-p/39554#M1235</guid>
      <dc:creator>Leah C.1</dc:creator>
      <dc:date>2015-06-17T23:43:12Z</dc:date>
    </item>
    <item>
      <title>Re: SwiftyDropbox (v0.2) - invalid_access_token</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/SwiftyDropbox-v0-2-invalid-access-token/m-p/39555#M1236</link>
      <description>&lt;P&gt;Thanks. Yes I am calling &lt;CODE&gt;Dropbox.handleRedirectURL(url)&lt;/CODE&gt; in my app delegate.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jun 2015 00:16:06 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/SwiftyDropbox-v0-2-invalid-access-token/m-p/39555#M1236</guid>
      <dc:creator>Peter M.107</dc:creator>
      <dc:date>2015-06-18T00:16:06Z</dc:date>
    </item>
    <item>
      <title>Re: SwiftyDropbox (v0.2) - invalid_access_token</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/SwiftyDropbox-v0-2-invalid-access-token/m-p/39556#M1237</link>
      <description>&lt;P&gt;Could you also include the code from the view controller where you're calling the DropboxAPI methods? Maybe also include your AppDelegate code? I tested the code from the blog post this morning and it appears to be working okay. Are you doing anything differently for your app?&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jun 2015 00:21:42 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/SwiftyDropbox-v0-2-invalid-access-token/m-p/39556#M1237</guid>
      <dc:creator>Leah C.1</dc:creator>
      <dc:date>2015-06-18T00:21:42Z</dc:date>
    </item>
    <item>
      <title>Re: SwiftyDropbox (v0.2) - invalid_access_token</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/SwiftyDropbox-v0-2-invalid-access-token/m-p/39557#M1238</link>
      <description>&lt;P&gt;Here's the code: &lt;A href="https://github.com/p15martin/DropboxStream" rel="nofollow noreferrer"&gt;https://github.com/p15martin/DropboxStream&lt;/A&gt;&lt;BR /&gt;
I can re-create the issue consistently. Grab the token. Call &lt;A href="https://api.dropbox.com/1/disable_access_token" rel="nofollow noreferrer"&gt;https://api.dropbox.com/1/disable_access_token&lt;/A&gt;. Restart the app.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jun 2015 00:49:00 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/SwiftyDropbox-v0-2-invalid-access-token/m-p/39557#M1238</guid>
      <dc:creator>Peter M.107</dc:creator>
      <dc:date>2015-06-18T00:49:00Z</dc:date>
    </item>
    <item>
      <title>Re: SwiftyDropbox (v0.2) - invalid_access_token</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/SwiftyDropbox-v0-2-invalid-access-token/m-p/39558#M1239</link>
      <description>&lt;P&gt;Thanks for the code!&lt;/P&gt;

&lt;P&gt;This is odd but I'm seeing nothing wrong. I'm able to link to Dropbox successfully. Here's the console output: &lt;A href="https://www.dropbox.com/s/mttaf63iotmhan7/Screenshot%202015-06-17%2011.01.49.png?dl=0" rel="nofollow noreferrer"&gt;https://www.dropbox.com/s/mttaf63iotmhan7/Screenshot%202015-06-17%2011.01.49.png?dl=0&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Each time I re-open the app, everything works fine too: &lt;A href="https://www.dropbox.com/s/zhvvoj39dup7z4z/Screenshot%202015-06-17%2011.02.11.png?dl=0" rel="nofollow noreferrer"&gt;https://www.dropbox.com/s/zhvvoj39dup7z4z/Screenshot%202015-06-17%2011.02.11.png?dl=0&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;If I call &lt;CODE&gt;/disable_access_token&lt;/CODE&gt; and re-open the app, I'm prompted to log in again, but then everything works as expected. Here's the console output:&lt;BR /&gt;
Init dropbox&lt;BR /&gt;
Has client&lt;BR /&gt;
Token has expired&lt;BR /&gt;
(note, at this point I'm prompted to re-auth)&lt;BR /&gt;
Success! User is logged into Dropbox.&lt;BR /&gt;
Reconnecting the account&lt;BR /&gt;
Has client&lt;BR /&gt;
Leah&lt;/P&gt;

&lt;P&gt;I wonder if it's an issue with the Dropbox account that you're using to test the app. Are you testing the app with the same account you used to create the app in the Dropbox app console?&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jun 2015 01:44:54 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/SwiftyDropbox-v0-2-invalid-access-token/m-p/39558#M1239</guid>
      <dc:creator>Leah C.1</dc:creator>
      <dc:date>2015-06-18T01:44:54Z</dc:date>
    </item>
    <item>
      <title>Re: SwiftyDropbox (v0.2) - invalid_access_token</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/SwiftyDropbox-v0-2-invalid-access-token/m-p/39559#M1240</link>
      <description>&lt;P&gt;In the code I shared I have a fix. In &lt;CODE&gt;AppDelegate&lt;/CODE&gt; under &lt;CODE&gt;Dropbox.handleRedirectURL(url)&lt;/CODE&gt;, I am calling &lt;CODE&gt;self.dropbox.verifyConnectionAfterAuth()&lt;/CODE&gt; which reconnects &lt;CODE&gt;Dropbox.authorizedClient&lt;/CODE&gt; and &lt;CODE&gt;DropboxClient.sharedClient&lt;/CODE&gt;. Try commenting it out and see if you get the problem. &lt;/P&gt;</description>
      <pubDate>Thu, 18 Jun 2015 02:58:52 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/SwiftyDropbox-v0-2-invalid-access-token/m-p/39559#M1240</guid>
      <dc:creator>Peter M.107</dc:creator>
      <dc:date>2015-06-18T02:58:52Z</dc:date>
    </item>
    <item>
      <title>Re: SwiftyDropbox (v0.2) - invalid_access_token</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/SwiftyDropbox-v0-2-invalid-access-token/m-p/39560#M1241</link>
      <description>&lt;P&gt;One thing you could do to improve this is in your AppDelegate's &lt;CODE&gt;- application:openURL:sourceApplication:annotation:&lt;/CODE&gt; try using &lt;CODE&gt;Dropbox.handleRedirectURL(url)&lt;/CODE&gt; instead of the lower-level method &lt;CODE&gt;DropboxAuthManager.sharedAuthManager.handleRedirectURL(url)&lt;/CODE&gt;. This will set the &lt;CODE&gt;Dropbox.authorizedClient&lt;/CODE&gt; for you, so you don't need to do it yourself: &lt;A href="https://github.com/dropbox/SwiftyDropbox/blob/master/Source/DropboxClient.swift#L67" rel="nofollow noreferrer"&gt;https://github.com/dropbox/SwiftyDropbox/blob/master/Source/DropboxClient.swift#L67&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;The &lt;CODE&gt;Dropbox&lt;/CODE&gt; class is really just a helpful wrapper around the &lt;CODE&gt;DropboxAuthManager&lt;/CODE&gt; for the case where you only expect one account to be authorized at a time.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jun 2015 03:51:03 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/SwiftyDropbox-v0-2-invalid-access-token/m-p/39560#M1241</guid>
      <dc:creator>Leah C.1</dc:creator>
      <dc:date>2015-06-18T03:51:03Z</dc:date>
    </item>
    <item>
      <title>Re: SwiftyDropbox (v0.2) - invalid_access_token</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/SwiftyDropbox-v0-2-invalid-access-token/m-p/39561#M1242</link>
      <description>&lt;P&gt;That resolves the problem! Thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jun 2015 11:55:31 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/SwiftyDropbox-v0-2-invalid-access-token/m-p/39561#M1242</guid>
      <dc:creator>Peter M.107</dc:creator>
      <dc:date>2015-06-18T11:55:31Z</dc:date>
    </item>
    <item>
      <title>Re: SwiftyDropbox (v0.2) - invalid_access_token</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/SwiftyDropbox-v0-2-invalid-access-token/m-p/39562#M1243</link>
      <description>&lt;P&gt;Oh good. Thanks so much for your feedback too!&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jun 2015 12:23:10 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/SwiftyDropbox-v0-2-invalid-access-token/m-p/39562#M1243</guid>
      <dc:creator>Leah C.1</dc:creator>
      <dc:date>2015-06-18T12:23:10Z</dc:date>
    </item>
  </channel>
</rss>

