<?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: Tokens only valid for 4 hours from app console in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Re-Tokens-only-valid-for-4-hours-from-app-console/m-p/576942#M26912</link>
    <description>&lt;P&gt;Dear community, dear GregDB,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;is there a possibility in the SDK for swift to refresh the token in the background without manual involvement of the app user? Although my app is configured to provide a permanent token (!) the connection is interrupted after a certain while and the users of my app have to repeat the approval manually in the Dropbox application which leads to a lot of annoyance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Before accessing dropbox I check the connectivity as follows:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;if let client = DropboxClientsManager.authorizedClient {
        client.files.listFolder(path: rootPfad).response {response, error in
            if let _ = error {
                ...
            } else {
                ...
            }
        }
    } else {
        connectDropbox(withRequest: Dropboxrequest.connect)
    }&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and if there is no authorizedClient then I reconnect as follows:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;func connectDropbox(withRequest request: Dropboxrequest) {
        dropboxrequest = request
        let scopeRequest = ScopeRequest(scopeType: .user, scopes: ["files.content.write", "files.content.read", "account_info.read"], includeGrantedScopes: true)
            DropboxClientsManager.authorizeFromControllerV2(
                UIApplication.shared,
                controller: self,
                loadingStatusDelegate: nil,
                openURL: { (url: URL) -&amp;gt; Void in UIApplication.shared.open(url, options: [:], completionHandler: nil) },
                scopeRequest: scopeRequest
            )
    }&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 10 Feb 2022 18:02:01 GMT</pubDate>
    <dc:creator>gcarl</dc:creator>
    <dc:date>2022-02-10T18:02:01Z</dc:date>
    <item>
      <title>Re: Tokens only valid for 4 hours from app console</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Re-Tokens-only-valid-for-4-hours-from-app-console/m-p/576942#M26912</link>
      <description>&lt;P&gt;Dear community, dear GregDB,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;is there a possibility in the SDK for swift to refresh the token in the background without manual involvement of the app user? Although my app is configured to provide a permanent token (!) the connection is interrupted after a certain while and the users of my app have to repeat the approval manually in the Dropbox application which leads to a lot of annoyance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Before accessing dropbox I check the connectivity as follows:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;if let client = DropboxClientsManager.authorizedClient {
        client.files.listFolder(path: rootPfad).response {response, error in
            if let _ = error {
                ...
            } else {
                ...
            }
        }
    } else {
        connectDropbox(withRequest: Dropboxrequest.connect)
    }&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and if there is no authorizedClient then I reconnect as follows:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="c"&gt;func connectDropbox(withRequest request: Dropboxrequest) {
        dropboxrequest = request
        let scopeRequest = ScopeRequest(scopeType: .user, scopes: ["files.content.write", "files.content.read", "account_info.read"], includeGrantedScopes: true)
            DropboxClientsManager.authorizeFromControllerV2(
                UIApplication.shared,
                controller: self,
                loadingStatusDelegate: nil,
                openURL: { (url: URL) -&amp;gt; Void in UIApplication.shared.open(url, options: [:], completionHandler: nil) },
                scopeRequest: scopeRequest
            )
    }&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Feb 2022 18:02:01 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Re-Tokens-only-valid-for-4-hours-from-app-console/m-p/576942#M26912</guid>
      <dc:creator>gcarl</dc:creator>
      <dc:date>2022-02-10T18:02:01Z</dc:date>
    </item>
    <item>
      <title>Re: Tokens only valid for 4 hours from app console</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Re-Tokens-only-valid-for-4-hours-from-app-console/m-p/576997#M26916</link>
      <description>&lt;P&gt;Yes, as long as you &lt;A href="https://github.com/dropbox/SwiftyDropbox#configure-your-project" target="_self"&gt;implement the authorization flow as shown&lt;/A&gt;, the SwiftyDropbox SDK will automatically handle the refresh process for you in the background, without any further manual user interaction required.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If something isn't working as expected, please show the steps you're following when seeing the issue and the unexpected error/output.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Feb 2022 16:28:23 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Re-Tokens-only-valid-for-4-hours-from-app-console/m-p/576997#M26916</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2022-02-10T16:28:23Z</dc:date>
    </item>
  </channel>
</rss>

