Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
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
)
}
Yes, as long as you implement the authorization flow as shown, the SwiftyDropbox SDK will automatically handle the refresh process for you in the background, without any further manual user interaction required.
If something isn't working as expected, please show the steps you're following when seeing the issue and the unexpected error/output.
Hi there!
If you need more help you can view your support options (expected response time for a ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!