I'm doing something wrong in the Auth flow for my iOS app, but after looking at the photo watch sample app, I can't figure out where I'm going wrong. The problem is, I always get an invalid_access_token when trying to access a file, even though I always get an authorized client.,
I have this in my AppDelegate:
DropboxClientsManager.setupWithAppKey("fawy4f14021rypr")
.
.
.
if DropboxClientsManager.authorizedClient != nil {
print("We have an authorized client. Now let's see if we can get the file attributes")After that, I try to access a file, like this...
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()
}
}
... which always results in an invalid_access_token, which looks like this:
[request-id 04ea10d76b6ff63d66aedb01b3d761be] API auth error - {
".tag" = "invalid_access_token";
}So I then go through the auth flow like this...
// Begin the Dropbopx authorization flow
DropboxClientsManager.authorizeFromController(UIApplication.shared, controller: self, openURL: { (url: URL) -> Void in UIApplication.shared.open(url, options: [:], completionHandler: nil) })
I understand this is a bit disjointed. If it helps, I will be glad to post all the code in context.
Thanks!