<?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: Short-lived token migration in Swift producing nil Client in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Short-lived-token-migration-in-Swift-producing-nil-Client/m-p/534170#M25726</link>
    <description>&lt;P&gt;The app authorization page in the browser connects back to the native app using a custom URL scheme, which the app sets in its plist file, from &lt;A href="https://github.com/dropbox/SwiftyDropbox#application-plist-file" target="_self"&gt;this step in the setup documentation&lt;/A&gt;. Specifically, it's the "db-&amp;lt;APP_KEY&amp;gt;" set in CFBundleURLSchemes under CFBundleURLTypes. (The Dropbox web page knows to redirect back to a URL using that URL scheme, which opens the app.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not familiar with Finder Sync extensions, but is there any reason it might be interfering with that URL scheme?&lt;/P&gt;</description>
    <pubDate>Tue, 20 Jul 2021 15:06:34 GMT</pubDate>
    <dc:creator>Greg-DB</dc:creator>
    <dc:date>2021-07-20T15:06:34Z</dc:date>
    <item>
      <title>Short-lived token migration in Swift producing nil Client</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Short-lived-token-migration-in-Swift-producing-nil-Client/m-p/533827#M25705</link>
      <description>&lt;P&gt;I'm migrating an old Swift app to SwiftyDropbox 6.0.3 and short-lived tokens with refresh; our app needs offline access. &amp;nbsp;But with the code changes, I'm getting odd behaviour -- the completion handler in&amp;nbsp;DropboxClientsManager&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;handleRedirectURL is never being called, with either a success or an error. &amp;nbsp;It just quietly&amp;nbsp;fails and DropboxClientsManager.authorizedClient remains nil.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Here's my code fragment, which is basically the old sample code. &amp;nbsp;First, I've set the event handler:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;NSAppleEventManager&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;shared&lt;SPAN&gt;().&lt;/SPAN&gt;setEventHandler&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;self&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt;,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;andSelector: &lt;SPAN&gt;&lt;STRONG&gt;#selector&lt;/STRONG&gt;&lt;/SPAN&gt;(&lt;SPAN&gt;handleGetURLEvent&lt;/SPAN&gt;),&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;forEventClass: &lt;SPAN&gt;AEEventClass&lt;/SPAN&gt;(&lt;SPAN&gt;kInternetEventClass&lt;/SPAN&gt;),&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;andEventID: &lt;SPAN&gt;AEEventID&lt;/SPAN&gt;(&lt;SPAN&gt;kAEGetURL&lt;/SPAN&gt;))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Then, there's the function which now calls authorizeFromControllerV2:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;func&lt;/STRONG&gt;&lt;/SPAN&gt; launchAuthorizeURL&lt;SPAN&gt;() {&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;let&lt;/STRONG&gt;&lt;/SPAN&gt; scopeRequest = &lt;SPAN&gt;ScopeRequest&lt;/SPAN&gt;(scopeType: .&lt;SPAN&gt;user&lt;/SPAN&gt;, scopes: [], includeGrantedScopes: &lt;SPAN&gt;&lt;STRONG&gt;true&lt;/STRONG&gt;&lt;/SPAN&gt;)&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;DropboxClientsManager&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;authorizeFromControllerV2&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;sharedWorkspace: &lt;SPAN&gt;NSWorkspace&lt;/SPAN&gt;.&lt;SPAN&gt;shared&lt;/SPAN&gt;,&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;controller: &lt;SPAN&gt;viewController&lt;/SPAN&gt;,&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;loadingStatusDelegate: &lt;SPAN&gt;&lt;STRONG&gt;nil&lt;/STRONG&gt;&lt;/SPAN&gt;,&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;openURL: { (url: &lt;SPAN&gt;URL&lt;/SPAN&gt;) -&amp;gt; &lt;SPAN&gt;Void&lt;/SPAN&gt; &lt;SPAN&gt;&lt;STRONG&gt;in&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;NSLog&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;"DbXConnect opening Dropbox URL"&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;NSWorkspace&lt;/SPAN&gt;.&lt;SPAN&gt;shared&lt;/SPAN&gt;.&lt;SPAN&gt;open&lt;/SPAN&gt;(url)&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;},&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;scopeRequest: scopeRequest &lt;/SPAN&gt;// I've also tried with a nil scopeRequest&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;)&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;}&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And the receiving end:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;@objc&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;STRONG&gt;func&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN&gt;handleGetURLEvent&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;_&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN&gt; event: &lt;/SPAN&gt;NSAppleEventDescriptor&lt;SPAN&gt;?, replyEvent: &lt;/SPAN&gt;NSAppleEventDescriptor&lt;SPAN&gt;?) {&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;if&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;STRONG&gt;let&lt;/STRONG&gt;&lt;/SPAN&gt; aeEventDescriptor = event?.&lt;SPAN&gt;paramDescriptor&lt;/SPAN&gt;(forKeyword: &lt;SPAN&gt;AEKeyword&lt;/SPAN&gt;(&lt;SPAN&gt;keyDirectObject&lt;/SPAN&gt;)) {&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;if&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;STRONG&gt;let&lt;/STRONG&gt;&lt;/SPAN&gt; urlStr = aeEventDescriptor.&lt;SPAN&gt;stringValue&lt;/SPAN&gt; {&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;STRONG&gt;// It gets here...&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;let&lt;/STRONG&gt;&lt;/SPAN&gt; url = &lt;SPAN&gt;URL&lt;/SPAN&gt;(string: urlStr)!&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;let&lt;/STRONG&gt;&lt;/SPAN&gt; oauthCompletion: &lt;SPAN&gt;DropboxOAuthCompletion&lt;/SPAN&gt; = {&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;print&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;"HandleGetURLEvent redirect completion handler running"&lt;SPAN&gt;) &amp;nbsp;&amp;nbsp;&lt;STRONG&gt;// It doesn't get here!&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;if&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN&gt;&lt;STRONG&gt;let&lt;/STRONG&gt;&lt;/SPAN&gt; authResult = $0 {&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;switch&lt;/STRONG&gt;&lt;/SPAN&gt; authResult {&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;case&lt;/STRONG&gt;&lt;/SPAN&gt; .&lt;SPAN&gt;success&lt;/SPAN&gt; (&lt;SPAN&gt;&lt;STRONG&gt;let&lt;/STRONG&gt;&lt;/SPAN&gt; newToken):&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;print&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;"handleGetURLEvent: Success! User is logged into Dropbox."&lt;SPAN&gt;)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;STRONG&gt;/* here I do my own setup */&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;// Launch confirmation page separately&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;NSWorkspace&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;shared&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;SPAN&gt;open&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;URL&lt;/SPAN&gt;&lt;SPAN&gt;(string: &lt;/SPAN&gt;"&lt;A href="https://mysite/response.html" target="_blank" rel="noopener"&gt;https://mysite/response.html&lt;/A&gt;"&lt;SPAN&gt;)!)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;case&lt;/STRONG&gt;&lt;/SPAN&gt; .&lt;SPAN&gt;cancel&lt;/SPAN&gt;:&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;STRONG&gt;print(&lt;/STRONG&gt;&lt;/SPAN&gt;"handleGetURLEvent: Authorization flow was manually canceled by user!")&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;case&lt;/STRONG&gt;&lt;/SPAN&gt; .&lt;SPAN&gt;error&lt;/SPAN&gt;(&lt;SPAN&gt;&lt;STRONG&gt;let&lt;/STRONG&gt;&lt;/SPAN&gt; errCode, &lt;SPAN&gt;&lt;STRONG&gt;let&lt;/STRONG&gt;&lt;/SPAN&gt; description):&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;print&lt;/SPAN&gt;(&lt;SPAN&gt;"HandleGetURLEvent Error: &lt;/SPAN&gt;\(description)&lt;SPAN&gt;"&lt;/SPAN&gt;)&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;}&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;}&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;}&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;let&lt;/STRONG&gt;&lt;/SPAN&gt; bResult = &lt;SPAN&gt;DropboxClientsManager&lt;/SPAN&gt;.&lt;SPAN&gt;handleRedirectURL&lt;/SPAN&gt;(url, completion: oauthCompletion)&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;// this brings your application back to the foreground on redirect&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;NSApp&lt;/SPAN&gt;.&lt;SPAN&gt;activate&lt;/SPAN&gt;(ignoringOtherApps: &lt;SPAN&gt;&lt;STRONG&gt;true&lt;/STRONG&gt;&lt;/SPAN&gt;)&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;}&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;}&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;client&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;DropboxClientsManager&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;authorizedClient&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;if&lt;/STRONG&gt;&lt;/SPAN&gt; (&lt;SPAN&gt;client&lt;/SPAN&gt; &lt;SPAN&gt;==&lt;/SPAN&gt; &lt;SPAN&gt;&lt;STRONG&gt;nil&lt;/STRONG&gt;&lt;/SPAN&gt;) {&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;STRONG&gt;// It reports an error here.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;}&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;}&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="Apple-converted-space"&gt;This code worked fine with the old authorizeFromController call (and still does if I switch back that one call).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;On a related note -- what's the best practice for how to specify offline token access with SwiftyDropbox? &amp;nbsp;Is that made available by default with authorizeFromControllerV2?&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jul 2021 22:32:21 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Short-lived-token-migration-in-Swift-producing-nil-Client/m-p/533827#M25705</guid>
      <dc:creator>Jon B.1</dc:creator>
      <dc:date>2021-07-26T22:32:21Z</dc:date>
    </item>
    <item>
      <title>Re: Short-lived token migration in Swift producing nil Client</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Short-lived-token-migration-in-Swift-producing-nil-Client/m-p/533901#M25706</link>
      <description>&lt;P&gt;I just gave this a try by setting up a new macOS project with your code snippets here, and it worked successfully for me. It got to "handleGetURLEvent: Success! User is logged into Dropbox.".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you let me know what versions of Xcode and macOS you're using? Also, what method did you use to install the SwiftyDropbox library?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The authorizeFromControllerV2 method automatically requests "offline" access.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jul 2021 14:15:30 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Short-lived-token-migration-in-Swift-producing-nil-Client/m-p/533901#M25706</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2021-07-19T14:15:30Z</dc:date>
    </item>
    <item>
      <title>Re: Short-lived token migration in Swift producing nil Client</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Short-lived-token-migration-in-Swift-producing-nil-Client/m-p/533908#M25707</link>
      <description>&lt;P&gt;Update on this: &amp;nbsp;turns out the completion handler *was* running consistently, it just took about two minutes to do so, and so other things were timing out as a result! &amp;nbsp;It looks like something is sitting on the main thread in my app, which was blocking the completion handler from running. &amp;nbsp;I'm still investigating.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Basically, there were more changes than I thought between my old SwiftyDropbox version and 6.0.3. &amp;nbsp;Rather than having the logic continue in the original thread, I've now refactored so that the code which checks the client status and proceeds to my own completion handler is only executed at the end of the handleRedirectURL completion handler.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But even after these changes, it's still taking about 45 seconds for the handleRedirectURL completion handler to run. &amp;nbsp;Is there anything I need to know about how 6.0.3 deals with the main queue, which could explain the blocking? &amp;nbsp;Or is this a problem with the rest of my app?&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jul 2021 14:20:11 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Short-lived-token-migration-in-Swift-producing-nil-Client/m-p/533908#M25707</guid>
      <dc:creator>Jon B.1</dc:creator>
      <dc:date>2021-07-19T14:20:11Z</dc:date>
    </item>
    <item>
      <title>Re: Short-lived token migration in Swift producing nil Client</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Short-lived-token-migration-in-Swift-producing-nil-Client/m-p/533912#M25709</link>
      <description>&lt;P&gt;Thanks for following up. I'm not aware of anything with the SwiftyDropbox SDK itself that would cause that. In my test, for instance, the entire completion handler runs pretty much instantaneously.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jul 2021 14:30:53 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Short-lived-token-migration-in-Swift-producing-nil-Client/m-p/533912#M25709</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2021-07-19T14:30:53Z</dc:date>
    </item>
    <item>
      <title>Re: Short-lived token migration in Swift producing nil Client</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Short-lived-token-migration-in-Swift-producing-nil-Client/m-p/533916#M25713</link>
      <description>&lt;P&gt;Following from my previous update -- this is SwiftyDropbox 6.0.3 installed using CocoaPods, and Xcode 12.5 on Big Sur 11.4. &amp;nbsp;But as I said, I'm now suspecting that there's something going on elsewhere in my app, blocking the dispatch queue which authorizeFromControllerV2 / handleRedirectURL is trying to use. &amp;nbsp;Are there guidelines about what parts of the auth process should or shouldn't be called on the main thread?&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jul 2021 14:35:05 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Short-lived-token-migration-in-Swift-producing-nil-Client/m-p/533916#M25713</guid>
      <dc:creator>Jon B.1</dc:creator>
      <dc:date>2021-07-19T14:35:05Z</dc:date>
    </item>
    <item>
      <title>Re: Short-lived token migration in Swift producing nil Client</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Short-lived-token-migration-in-Swift-producing-nil-Client/m-p/533932#M25716</link>
      <description>&lt;P&gt;I don't believe there's any specific guidance with respect to threading for the authorization process. The &lt;A href="https://github.com/dropbox/SwiftyDropbox#handling-the-authorization-flow" target="_self"&gt;official documentation for implementing the app authorization flow can be found here&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jul 2021 15:15:41 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Short-lived-token-migration-in-Swift-producing-nil-Client/m-p/533932#M25716</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2021-07-19T15:15:41Z</dc:date>
    </item>
    <item>
      <title>Re: Short-lived token migration in Swift producing nil Client</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Short-lived-token-migration-in-Swift-producing-nil-Client/m-p/534150#M25725</link>
      <description>&lt;P&gt;Here's a bit more on this. &amp;nbsp;The problem seems to be a timeout that's causing the application to sit for up to one minute between me pressing "Allow Safari to open [my app]" after pressing the Allow button during the auth process, and the event actually being received in my code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As far as I can tell, there doesn't appear to be anything else running in my app at all during that time, it's completely idling. &amp;nbsp;But here's the weird bit -- my app has a FinderSync extension, as part of the same app group, which is trying to connect to the main application through a socket. &amp;nbsp;(It's not succeeding, because my app doesn't start listening until after the Dropbox connection is in place.) &amp;nbsp;But it keeps retrying for a minute before closing the socket... &amp;nbsp;and after it closes, suddenly the response comes through from Safari to my handleGetURLEvent method.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note that none of this happened with the old SwiftyDropbox 3/4 version! &amp;nbsp;So I guess the next question is, how are the auth pages trying to send the message back to the main application, so that the kAEGetURL event is getting held up by either the app or the FinderSync handler in the same app group?...&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jul 2021 14:12:09 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Short-lived-token-migration-in-Swift-producing-nil-Client/m-p/534150#M25725</guid>
      <dc:creator>Jon B.1</dc:creator>
      <dc:date>2021-07-20T14:12:09Z</dc:date>
    </item>
    <item>
      <title>Re: Short-lived token migration in Swift producing nil Client</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Short-lived-token-migration-in-Swift-producing-nil-Client/m-p/534170#M25726</link>
      <description>&lt;P&gt;The app authorization page in the browser connects back to the native app using a custom URL scheme, which the app sets in its plist file, from &lt;A href="https://github.com/dropbox/SwiftyDropbox#application-plist-file" target="_self"&gt;this step in the setup documentation&lt;/A&gt;. Specifically, it's the "db-&amp;lt;APP_KEY&amp;gt;" set in CFBundleURLSchemes under CFBundleURLTypes. (The Dropbox web page knows to redirect back to a URL using that URL scheme, which opens the app.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not familiar with Finder Sync extensions, but is there any reason it might be interfering with that URL scheme?&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jul 2021 15:06:34 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Short-lived-token-migration-in-Swift-producing-nil-Client/m-p/534170#M25726</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2021-07-20T15:06:34Z</dc:date>
    </item>
    <item>
      <title>Re: Short-lived token migration in Swift producing nil Client</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Short-lived-token-migration-in-Swift-producing-nil-Client/m-p/534564#M25740</link>
      <description>&lt;P&gt;I think I've resolved it -- I'm still not sure why it was interfering with that URL scheme in the main program, but that may be down to the Group Container settings which lump the app and the Finder Sync extension together for communication purposes!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The source of the problem was that the Finder Sync extension was trying to connect to the socket on *its* main thread, and taking a full minute to fail. &amp;nbsp;By moving the connection attempt off of the main DispatchQueue onto a low-priority one, the problem with Dropbox not being able to get through to the main program vanished.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Strange, but hey, if it works...!&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jul 2021 02:43:11 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Short-lived-token-migration-in-Swift-producing-nil-Client/m-p/534564#M25740</guid>
      <dc:creator>Jon B.1</dc:creator>
      <dc:date>2021-07-22T02:43:11Z</dc:date>
    </item>
  </channel>
</rss>

