<?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: Getting &amp;quot;invalid_access_token&amp;quot; after getting DropboxClientsManager.authorizedClient in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Getting-quot-invalid-access-token-quot-after-getting/m-p/323106#M18987</link>
    <description>&lt;P&gt;Also, here is my code&amp;nbsp;in my&amp;nbsp;ConnectToDropboxViewController where I begin the authorization flow:&lt;/P&gt;&lt;PRE&gt;    @IBAction func connectToDropboxButtonTapped(_ sender: Any) {
        // Begin the Dropbopx authorization flow
        DropboxClientsManager.authorizeFromController(UIApplication.shared, controller: self, openURL: { (url: URL) -&amp;gt; Void in UIApplication.shared.open(url, options: [:], completionHandler: nil) })&lt;/PRE&gt;</description>
    <pubDate>Mon, 14 Jan 2019 19:05:58 GMT</pubDate>
    <dc:creator>RJKinsman</dc:creator>
    <dc:date>2019-01-14T19:05:58Z</dc:date>
    <item>
      <title>Getting "invalid_access_token" after getting DropboxClientsManager.authorizedClient</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Getting-quot-invalid-access-token-quot-after-getting/m-p/322856#M18976</link>
      <description>&lt;P&gt;I'm doing something wrong in the Auth flow for my iOS app, but&amp;nbsp;after looking at the&amp;nbsp;photo watch sample app, I can't&amp;nbsp;figure out&amp;nbsp;where I'm going wrong. The problem is, I &lt;EM&gt;always&lt;/EM&gt; get&amp;nbsp;&lt;SPAN&gt;an invalid_access_token when trying to access a file, even though I &lt;EM&gt;always&lt;/EM&gt; get an authorized client.,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I have this in my&amp;nbsp;AppDelegate:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt; DropboxClientsManager.setupWithAppKey("fawy4f14021rypr")&lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;       if DropboxClientsManager.authorizedClient != nil {
            print("We have an authorized client.  Now let's see if we can get the file attributes")&lt;/PRE&gt;&lt;P&gt;After that, I try to access a file, like this...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;             client!.files.getMetadata(path: "/Nvelopes.csv")
                .response {response, error in
                    if let (_) = response {
                        dropboxGo = true
                        self.dispatchGroup.leave()
                                        }
                    else if let error = error {
                        print("Did not find Nvelopes.csv in Dropbox:")
                        print(error.description)
                        self.dispatchGroup.leave()
                                            }
             }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;... which always&lt;/EM&gt;&amp;nbsp;results in an invalid_access_token, which looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;[request-id 04ea10d76b6ff63d66aedb01b3d761be] API auth error - {
    ".tag" = "invalid_access_token";
}&lt;/PRE&gt;&lt;P&gt;So I then&amp;nbsp;go through the auth flow like this...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;        // Begin the Dropbopx authorization flow
        DropboxClientsManager.authorizeFromController(UIApplication.shared, controller: self, openURL: { (url: URL) -&amp;gt; Void in UIApplication.shared.open(url, options: [:], completionHandler: nil) })&lt;/PRE&gt;&lt;P&gt;I understand this is a bit disjointed.&amp;nbsp; If it helps, I will be glad to post all the code in context.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:08:25 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Getting-quot-invalid-access-token-quot-after-getting/m-p/322856#M18976</guid>
      <dc:creator>RJKinsman</dc:creator>
      <dc:date>2019-05-29T09:08:25Z</dc:date>
    </item>
    <item>
      <title>Re: Getting "invalid_access_token" after getting DropboxClientsManager.authorizedClient</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Getting-quot-invalid-access-token-quot-after-getting/m-p/323047#M18978</link>
      <description>&lt;P&gt;I have an update.&amp;nbsp; Suddenly the attempt to get file attributes after getting the client started working.&amp;nbsp; I don't know how to explain it.&lt;/P&gt;&lt;P&gt;Do I need to save and use the same access token?&amp;nbsp; If yes, how do I pass it back into the API?&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 15:40:50 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Getting-quot-invalid-access-token-quot-after-getting/m-p/323047#M18978</guid>
      <dc:creator>RJKinsman</dc:creator>
      <dc:date>2019-01-14T15:40:50Z</dc:date>
    </item>
    <item>
      <title>Re: Getting "invalid_access_token" after getting DropboxClientsManager.authorizedClient</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Getting-quot-invalid-access-token-quot-after-getting/m-p/323063#M18985</link>
      <description>&lt;P&gt;It looks like you're using the SwiftyDropbox SDK. You&amp;nbsp;should save and re-use an access token once you get one, but the SDK does this for you automatically.&lt;/P&gt;
&lt;P&gt;Can you confirm you &lt;A href="https://github.com/dropbox/SwiftyDropbox#configure-your-project" target="_self"&gt;configured your project&lt;/A&gt; and &lt;A href="https://github.com/dropbox/SwiftyDropbox#handling-the-authorization-flow" target="_self"&gt;implemented the authorization flow&lt;/A&gt; exactly as documented? You didn't share your code for &lt;A href="https://github.com/dropbox/SwiftyDropbox#handle-redirect-back-into-sdk" target="_self"&gt;the "Handle redirect back into SDK" step&lt;/A&gt;&amp;nbsp;in particular.&lt;/P&gt;
&lt;P&gt;In any case, note that while access tokens currently don't expire on their own, they can be revoked by the app or user at any time. For that reason, you should make sure your app is able to catch an&amp;nbsp;&lt;A href="https://dropbox.github.io/SwiftyDropbox/api-docs/latest/Classes/Auth/AuthError.html" target="_blank"&gt;AuthError&lt;/A&gt; at any time. If the access token &lt;A href="https://dropbox.github.io/SwiftyDropbox/api-docs/latest/Classes/Auth/AuthError.html#/s:13SwiftyDropbox4AuthC0C5ErrorO18invalidAccessTokenyA2EmF" target="_self"&gt;is invalid&lt;/A&gt;, you &lt;A href="https://github.com/dropbox/SwiftyDropbox#single-dropbox-user-case" target="_blank"&gt;should throw it away and prompt the user to authorize your app again&lt;/A&gt;, if they still want to use the integration.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 16:12:39 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Getting-quot-invalid-access-token-quot-after-getting/m-p/323063#M18985</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2019-01-14T16:12:39Z</dc:date>
    </item>
    <item>
      <title>Re: Getting "invalid_access_token" after getting DropboxClientsManager.authorizedClient</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Getting-quot-invalid-access-token-quot-after-getting/m-p/323105#M18986</link>
      <description>&lt;P&gt;Thanks, Greg.&amp;nbsp; I implemented the authorization flow as documented,&amp;nbsp;to the best of my ability.&amp;nbsp; Here is my application function where I handle the redirect back into the SDK:&lt;/P&gt;&lt;PRE&gt;    func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -&amp;gt; Bool {
        // Set up the viewcontroller variable
        
        var nvelopesViewController: UIViewController
        self.window = UIWindow(frame: UIScreen.main.bounds)
        let mainStoryboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
        if let authResult = DropboxClientsManager.handleRedirectURL(url) {
            switch authResult {
            case .success(let token):
                print("Success! User is logged into Dropbox with token: \(token)")

                // Set the regular ViewController
                nvelopesViewController = mainStoryboard.instantiateViewController(withIdentifier: "sbNvelopes") as UIViewController
                
                // Display the selected View
                self.window?.rootViewController = nvelopesViewController
                self.window?.makeKeyAndVisible()
            case .cancel:
                print("Authorization flow was manually canceled by user!")
            case .error(_, let description):
                print("Error: \(description)")
            }
        }
        return true
    }&lt;/PRE&gt;</description>
      <pubDate>Mon, 14 Jan 2019 18:58:00 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Getting-quot-invalid-access-token-quot-after-getting/m-p/323105#M18986</guid>
      <dc:creator>RJKinsman</dc:creator>
      <dc:date>2019-01-14T18:58:00Z</dc:date>
    </item>
    <item>
      <title>Re: Getting "invalid_access_token" after getting DropboxClientsManager.authorizedClient</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Getting-quot-invalid-access-token-quot-after-getting/m-p/323106#M18987</link>
      <description>&lt;P&gt;Also, here is my code&amp;nbsp;in my&amp;nbsp;ConnectToDropboxViewController where I begin the authorization flow:&lt;/P&gt;&lt;PRE&gt;    @IBAction func connectToDropboxButtonTapped(_ sender: Any) {
        // Begin the Dropbopx authorization flow
        DropboxClientsManager.authorizeFromController(UIApplication.shared, controller: self, openURL: { (url: URL) -&amp;gt; Void in UIApplication.shared.open(url, options: [:], completionHandler: nil) })&lt;/PRE&gt;</description>
      <pubDate>Mon, 14 Jan 2019 19:05:58 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Getting-quot-invalid-access-token-quot-after-getting/m-p/323106#M18987</guid>
      <dc:creator>RJKinsman</dc:creator>
      <dc:date>2019-01-14T19:05:58Z</dc:date>
    </item>
    <item>
      <title>Re: Getting "invalid_access_token" after getting DropboxClientsManager.authorizedClient</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Getting-quot-invalid-access-token-quot-after-getting/m-p/323113#M18988</link>
      <description>&lt;P&gt;Thanks! I don't see anything clearly wrong here.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It sounds like it's working now, but let me know if you are able to reproduce the issue again unexpectedly.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For reference, you should be able to intentionally cause that by e.g., &lt;A href="https://www.dropbox.com/account/connected_apps" target="_self"&gt;unlinking the app&lt;/A&gt;, or deleting the app folder (if you're using an app with the app folder permission).&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 19:36:21 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Getting-quot-invalid-access-token-quot-after-getting/m-p/323113#M18988</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2019-01-14T19:36:21Z</dc:date>
    </item>
    <item>
      <title>Re: Getting "invalid_access_token" after getting DropboxClientsManager.authorizedClient</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Getting-quot-invalid-access-token-quot-after-getting/m-p/323114#M18989</link>
      <description>&lt;P&gt;Great, thanks for the advice.&amp;nbsp; Yes, working&amp;nbsp;is a good thing.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Jan 2019 19:38:54 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Getting-quot-invalid-access-token-quot-after-getting/m-p/323114#M18989</guid>
      <dc:creator>RJKinsman</dc:creator>
      <dc:date>2019-01-14T19:38:54Z</dc:date>
    </item>
  </channel>
</rss>

