We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
Samikay
5 years agoExplorer | Level 4
[ObjC] Having trouble init'ing a UserClient with the new refresh token?
Quite likely missing something obvious, trying to migrate to the short-lived access tokens, so first change the authorize:
authorizeFromControllerV2
save the refresh token:
...
- 5 years ago
We've added the ability to supply a DBAccessToken (which can contain a refresh token) directly which is available as of v6.2.0. Please give that a try and let us know if that doesn't work for you. Thanks!
Greg-DB
Dropbox Community Moderator
5 years agoYou shouldn't actually have to do most of this work in your own code. As long as you use the authorizeFromControllerV2 method to start the authorization flow as shown here, and then receive the result as shown here, the SDK would then handle the token storage and refresh process for you automatically. You would use the supplied authorizedClient as shown here to perform whatever calls you need.
Please give that flow a try and let me know if it's not working. Thanks!
- Samikay5 years agoExplorer | Level 4
Hmm, unfortunately for our use case we have the user able to auth once on web/Android/iOS and be able to upload on any of those devices by sharing the Dropbox access token when they log into their (our app's) account (so we handle the storage of the tokens instead of the SDK and then init DBUserClients [or equivalent] on each platform), with long-lived tokens this was easy and worked nicely, short-lived makes it a tad more interesting. Based on your reply I'll yoink the internal code out and play around 😛
- Samikay5 years agoExplorer | Level 4
Ah, I should mention when I implemented it in Android it was quite simple because DbxCredential takes a refresh token as an init parameter:
new DbxCredential(accessToken, 0L, refreshToken, DROPBOX_APP_KEY) return new DbxClientV2(dropboxRequestConfig(), credential);Hence why I was looking for the iOS equivalent 😄
- Greg-DB5 years ago
Dropbox Community Moderator
I see, thanks for clarifying! I'll send this along as a request to the team to see if we can publicly expose something to do that in the Objective-C SK.
About Discuss Dropbox Developer & API
Make connections with 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!