<?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 How to re-link a user in API 2 (Handling Revoked Access Etc) in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-re-link-a-user-in-API-2-Handling-Revoked-Access-Etc/m-p/192107#M8494</link>
    <description>&lt;P&gt;In API 1, I could offer the user an option to re-link (re-authorise) Dropbox if they run into issues because their access token had expired or been revoked. I could do this as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First, I listened for the DBSession delegate method:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;- (void)sessionDidReceiveAuthorizationFailure:(DBSession * )session userId:(NSString * )userId&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then, if I received this notification, I did&amp;nbsp;two things:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Offer the user the&amp;nbsp;chance to re-link Dropbox then and there (given that re-linking should be all that is required, as&amp;nbsp;described in Core API Best Practises: &amp;lt;&lt;A href="https://www.dropbox.com/developers-v1/core/bestpractices" target="_blank"&gt;https://www.dropbox.com/developers-v1/core/bestpractices&lt;/A&gt;&amp;gt;).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. Make note in a flag that there had been a session authorisation failure. Then, in a sync options menu, if this flag was YES, I would offer a "Re-Link Dropbox" option. In both cases, I could just call:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;NSArray *userIds = [[DBSession sharedSession] userIds];
if (userIDs.count &amp;gt; 0)
    [[DBSession sharedSession] linkUserId:userIds[0] fromController:self];&lt;/PRE&gt;&lt;P&gt;Or, when calling this directly from the DBSession delegate method, I could pass in the userId directly because it was a parameter in the delegate method:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;[[DBSession sharedSession] linkUserId:userId fromController:self];&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is the equivalent for re-linking following an authorisation failure owing to a&amp;nbsp;revoked or expired access token&amp;nbsp;in API 2?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At first I thought it was&amp;nbsp;DropboxClientManager's -reauthorizeClient:, but that relies on grabbing the access token from [[DropboxClientsManager authorizedClient] transportClient].accessToken], and that won't be available (I believe) if authorisation has failed. And anyway, I believe this uses the very access token which has expired or&amp;nbsp;been revoked in this situation. (In which case, what is -reauthorizeClient: for?)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do I just call -authorizeFromController:controller:openURL:browserAuth: again to re-link in API 2, the same as for linking in the first place? Or is there a dedicated method like there was in API 1?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Keith&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 29 May 2019 09:28:53 GMT</pubDate>
    <dc:creator>Keith B.7</dc:creator>
    <dc:date>2019-05-29T09:28:53Z</dc:date>
    <item>
      <title>How to re-link a user in API 2 (Handling Revoked Access Etc)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-re-link-a-user-in-API-2-Handling-Revoked-Access-Etc/m-p/192107#M8494</link>
      <description>&lt;P&gt;In API 1, I could offer the user an option to re-link (re-authorise) Dropbox if they run into issues because their access token had expired or been revoked. I could do this as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First, I listened for the DBSession delegate method:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;- (void)sessionDidReceiveAuthorizationFailure:(DBSession * )session userId:(NSString * )userId&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then, if I received this notification, I did&amp;nbsp;two things:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Offer the user the&amp;nbsp;chance to re-link Dropbox then and there (given that re-linking should be all that is required, as&amp;nbsp;described in Core API Best Practises: &amp;lt;&lt;A href="https://www.dropbox.com/developers-v1/core/bestpractices" target="_blank"&gt;https://www.dropbox.com/developers-v1/core/bestpractices&lt;/A&gt;&amp;gt;).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. Make note in a flag that there had been a session authorisation failure. Then, in a sync options menu, if this flag was YES, I would offer a "Re-Link Dropbox" option. In both cases, I could just call:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;NSArray *userIds = [[DBSession sharedSession] userIds];
if (userIDs.count &amp;gt; 0)
    [[DBSession sharedSession] linkUserId:userIds[0] fromController:self];&lt;/PRE&gt;&lt;P&gt;Or, when calling this directly from the DBSession delegate method, I could pass in the userId directly because it was a parameter in the delegate method:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;[[DBSession sharedSession] linkUserId:userId fromController:self];&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What is the equivalent for re-linking following an authorisation failure owing to a&amp;nbsp;revoked or expired access token&amp;nbsp;in API 2?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At first I thought it was&amp;nbsp;DropboxClientManager's -reauthorizeClient:, but that relies on grabbing the access token from [[DropboxClientsManager authorizedClient] transportClient].accessToken], and that won't be available (I believe) if authorisation has failed. And anyway, I believe this uses the very access token which has expired or&amp;nbsp;been revoked in this situation. (In which case, what is -reauthorizeClient: for?)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do I just call -authorizeFromController:controller:openURL:browserAuth: again to re-link in API 2, the same as for linking in the first place? Or is there a dedicated method like there was in API 1?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Keith&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:28:53 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-re-link-a-user-in-API-2-Handling-Revoked-Access-Etc/m-p/192107#M8494</guid>
      <dc:creator>Keith B.7</dc:creator>
      <dc:date>2019-05-29T09:28:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to re-link a user in API 2 (Handling Revoked Access Etc)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-re-link-a-user-in-API-2-Handling-Revoked-Access-Etc/m-p/192183#M8511</link>
      <description>&lt;P&gt;That's right, &lt;A href="https://dropbox.github.io/dropbox-sdk-obj-c/api-docs/latest/Classes/DropboxClientsManager.html#/c:objc(cs)DropboxClientsManager(cm)reauthorizeClient:" target="_self"&gt;reauthorizeClient&lt;/A&gt;&amp;nbsp;isn't for this case. That's meant for when you want to retrieve an authorized client for a user account for which you already have an access token.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For the revoked access token case, you can just&amp;nbsp;catch the authorization failure (the InvalidAccessToken &lt;A href="https://dropbox.github.io/dropbox-sdk-obj-c/api-docs/latest/Classes/DBAUTHAuthError.html#/c:objc(cs)DBAUTHAuthError(im)isInvalidAccessToken" target="_self"&gt;DBAUTHAuthError&lt;/A&gt;&amp;nbsp;from &lt;A href="https://dropbox.github.io/dropbox-sdk-obj-c/api-docs/latest/Classes/DBRequestAuthError.html#/c:objc(cs)DBRequestAuthError(py)structuredAuthError" target="_self"&gt;DBRequestAuthError&lt;/A&gt;) and then call&amp;nbsp;authorizeFromController again to have the user re-link and get a new access token.&lt;/P&gt;</description>
      <pubDate>Wed, 26 Oct 2016 21:29:36 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-re-link-a-user-in-API-2-Handling-Revoked-Access-Etc/m-p/192183#M8511</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2016-10-26T21:29:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to re-link a user in API 2 (Handling Revoked Access Etc)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-re-link-a-user-in-API-2-Handling-Revoked-Access-Etc/m-p/192212#M8518</link>
      <description>&lt;P&gt;Great, thanks for the clarification. So, instead of an equivalent of DBSession's -sessionDidReceiveAuthorizationFailure: delegate method, I check for DBError's -isAuthFailure in the response of any of the Dropbox requests? That makes sense, thanks!&lt;/P&gt;</description>
      <pubDate>Thu, 27 Oct 2016 09:03:48 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-re-link-a-user-in-API-2-Handling-Revoked-Access-Etc/m-p/192212#M8518</guid>
      <dc:creator>Keith B.7</dc:creator>
      <dc:date>2016-10-27T09:03:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to re-link a user in API 2 (Handling Revoked Access Etc)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-re-link-a-user-in-API-2-Handling-Revoked-Access-Etc/m-p/192284#M8527</link>
      <description>&lt;P&gt;That's right. There's a simple example &lt;A href="https://github.com/dropbox/dropbox-sdk-obj-c#generic-network-request-errors" target="_self"&gt;here&lt;/A&gt;, but you may want to handle the more specific cases (e.g., invalid access token versus suspended user) in&amp;nbsp;the&amp;nbsp;&lt;A href="https://dropbox.github.io/dropbox-sdk-obj-c/api-docs/latest/Classes/DBAUTHAuthError.html" target="_self"&gt;DBAUTHAuthError&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Oct 2016 17:44:07 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-re-link-a-user-in-API-2-Handling-Revoked-Access-Etc/m-p/192284#M8527</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2016-10-27T17:44:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to re-link a user in API 2 (Handling Revoked Access Etc)</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-re-link-a-user-in-API-2-Handling-Revoked-Access-Etc/m-p/192289#M8530</link>
      <description>&lt;P&gt;Great, thanks. Following your advice, I've got checking for revoked access and re-linking all working - much appreciated!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All the best,&lt;BR /&gt;Keith&lt;/P&gt;</description>
      <pubDate>Thu, 27 Oct 2016 18:01:12 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-re-link-a-user-in-API-2-Handling-Revoked-Access-Etc/m-p/192289#M8530</guid>
      <dc:creator>Keith B.7</dc:creator>
      <dc:date>2016-10-27T18:01:12Z</dc:date>
    </item>
  </channel>
</rss>

