There are 2 issues I would like to get some clarity on.
Environment: Xcode 12 / IOS 14.4 / SwiftyDropbox
I want to download a file from a shared scoped dropbox Folder. Previously I did not enable the files.content.read scope and thus I am getting the below error.
Printing description of error:
▿ [request-id 672ec403478646ebbc3bb15bea5a631f] API auth error - {
".tag" = "missing_scope";
"required_scope" = "files.content.read";
}
This error comes via a simple print(error)
_ = client.files.download(path: dbFile.pathLower!, destination: destination)
.response { response, error in
if let (_, url) = response {
/// Downloaded a copy of Remote file. Append into LocalFile list
print("DOWNLOADED DropBox File:\(url.lastPathComponent)")
localFileList.append(dbFileNameRev)
} else if let callError = error {
print("\n\n::::::\n\(#function):: ERROR downloading file from Dropbox: \(error)")
}
}
Problem #1:
I would like to be able to get to the "missing_scope" error message and despite trying out the few examples I found on SO and in SwiftyDropbox documentation, I'm still unclear on how to get access the the nested cases/switch statement. (the swiftydropbox documentation provides example of /delete) and this https://riptutorial.com/dropbox-api/example/1351/downloading-a-file-with-every-error-case-handled-using-the-swiftydropbox-library wasn't quite helpful
I tried playing around and doing some trial and error to no avail.
Problem #2
I have no enabled the file.content.read scoped access in app console as well as within the code during the authorisation request, but this would only take into effect for NEW authorisations and not existing ones. (hence the error shown above). The documentation says to re-authorise the user again. However, I'm having issue whereby the authorisation call needs a ViewController reference. Is there method I can call the authorisation from a function instead?