Dear community, dear GregDB,
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.
Before accessing dropbox I check the connectivity as follows:
if let client = DropboxClientsManager.authorizedClient {
client.files.listFolder(path: rootPfad).response {response, error in
if let _ = error {
...
} else {
...
}
}
} else {
connectDropbox(withRequest: Dropboxrequest.connect)
}
and if there is no authorizedClient then I reconnect as follows:
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) -> Void in UIApplication.shared.open(url, options: [:], completionHandler: nil) },
scopeRequest: scopeRequest
)
}