We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
gcarl
4 years agoExplorer | Level 4
Re: Tokens only valid for 4 hours from app console
Dear greg-DB,
sorry, but I have to come back to this topic again, since I couldn't solve it in the recent weeks despite all these valuable hints in this forum and the description for the Swift ...
Greg-DB
Dropbox Community Moderator
4 years agoCan you elaborate on what you mean when you say "the connection is interrupted"? Do you get a particular error? If so, please share it here. Or, do you mean that DropboxClientsManager.authorizedClient just becomes nil at that point?
- gcarl4 years agoExplorer | Level 4
Dear Greg-DB,
it is the latter one - I get the "nil" as response in the availability check. I understood the whole discussion that this shouldn't be the case and the refresh should happen automatically via the refresh token in the background instead. Is this correct?
Thanks for the support
- Greg-DB4 years ago
Dropbox Community Moderator
Thanks for clarifying. That's correct, the refresh process should be handled for you automatically as long as you've processed the authorization flow using authorizeFromControllerV2.
Even if you did only have a short-lived access token stored though, or if the refresh process failed and the SDK wasn't able to get a new short-lived access token, you would still have the expired access token stored so you would have a non-nil authorizedClient and should get back a specific error like 'expired_access_token' when attempting a call.
So, from your description, with the issue occurring sooner than four hours, and with authorizedClient itself being nil, it sounds like the issue isn't actually with the access token expiration itself. It seems as if the token isn't being persisted successfully. The SDK uses the system's keychain functionality to store and retrieve the tokens.
Does the authorizedClient seem to get lost after any particular event, such as when the app (or device) is restarted?
Does this happen on multiple different devices? (I've occasionally heard of issues with the keychain not working properly on specific devices.)
Do you perhaps get any error/output during the authorizeFromControllerV2/handleRedirectURL flow?
- gcarl4 years agoExplorer | Level 4
Dear Greg-DB,
I don't get any error messages when initially connecting or reconnecting to the Dropbox. Nor is there a pattern when the reconnection doesn't work. It even happens during working with the app for a longer time when the user wants to store data on Dropbox. It happens on different devices e.g. iPhone 8 and iPhone 12.
Is there a command in swift to to initiate the refresh of the token programmatically?
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
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!