You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
Bob S.15
3 years agoCollaborator | Level 9
Attempt to relink Dropbox? keeps recurring
I updated my iOS app to use the latest Dropbox SDK over the weekend, and initially it seemed fine. But now I notice that whenever I go someplace new and reopen my app, it says my Dropbox account is no longer connected and I have to relink it. Any idea what would cause that to happen? The app thinks it is linked to an unknown account, until I unlink and then relink it.
It is not just a matter of restarting the app. If I terminate and relaunch, then it works. It seems to be maybe when I switch WiFi networks that triggers it. I'm not sure...
Any ideas?
Thanks
Bob
- Greg-DBDropbox Staff
I'll be happy to help with any issues you're having with the Dropbox API, but I'll need some more information. Please reply with:
- the name and version number of the platform and SDK you are using
- the steps to reproduce the issue, including relevant code snippet(s), but don't include any access or refresh token(s)
- the full text of any error or unexpected output
- Bob S.15Collaborator | Level 9
This is iOS. According to the Info.plist in the Dropbox framework, it's version 3.6.2.
When the app first starts I see this, not sure if it is important:
-[NSKeyedUnarchiver validateAllowedClass:forKey:] allowed unarchiving safe plist type ''NSString' (0xxxxxxx) [/System/Library/Frameworks/Foundation.framework]' for key 'accessToken', even though it was not explicitly included in the client allowed classes set: '{(
"'DBAccessToken' (0xxxxxxx) [/var/containers/Bundle/Application/xxxxxxx/XXXXXX.app/Frameworks/ObjectiveDropboxOfficial.framework]"
)}'. This will be disallowed in the future.
Then a bit later I think from this -[Uploader(Private) connection:didReceiveData:]: self:0xxxxxxxx
getCurrentAccount returned2022-07-08 08:37:09.878568-0500 xxxxx[xxx:xxxx] DropboxAuthError[{
ErrorContent = "expired_access_token/...";
RequestId = xxxxxxxxxxxxxxxxxxxx;
StatusCode = 401;
StructuredAuthError = "<DBAUTHAuthError: 0x282311ae0>";
UserMessage = nil;
}];
Any idea why my access token would expire?
- Bob S.15Collaborator | Level 9
Going over the Github documentation, I suspect this is happening because I still use the long-lived token and had not switched to the V2 version...
So ... I switched to using the "newest" method with DBScopeRequest, but now it will no longer authorize even temporarily. It does not open the Dropbox app or Safari to authenticate anymore. And when I switched back to the way my code was before, it does the same thing - no longer authorizing.
Currently in my code I am checking if [[DBClientsManager authorizedClient] != nil) then I assume the app is authorized. But I guess that is no longer true? It is giving me the "expired access token" error even though DBClientsManager authorizedClient] != nil. Is that expected?
If I disregard the fact that I supposedly have an authorizedClient and I call authorizeFromControllerV2, it does open the Dropbox app and ask me to Allow, but then gives an error "An error occurred authorizing your app. Please try again." The only thing in the log at that point is "DBSDKReachability Flag Status" -R"
- ЗдравкоLegendary | Level 20
Hi Bob S.15,
Some time ago long lived access token (the one your application relies on) was deprecated. Such tokens can still be used, if exist, but since recent can NOT more be issued. All new issued tokens are short lived (usually start with "sl.") with validity for 4 hours, at most. Most probably you haven't re-linked your application for long time and since existing long lived access token keep validity, you didn't noticed the change.
Bob S.15 wrote:
I updated my iOS app to use the latest Dropbox SDK over the weekend, and initially it seemed fine. But now I notice that whenever I go someplace new and reopen my app, it says my Dropbox account is no longer connected and I have to relink it. ...Here you did invalidate your long lived access token (with the update) and that's why your application gets started behave "strange". You know what "strange" means here, I believe. 🙂
To solve this, you have to keep newly introduced refresh token, resulted on initial authentication steps. After that you can use proper form of client instantiation that includes the refresh token. Properly constructed client will take care for the refresh process an you will no more receive something like:
Bob S.15 wrote:...
getCurrentAccount returned2022-07-08 08:37:09.878568-0500 xxxxx[xxx:xxxx] DropboxAuthError[{
ErrorContent = "expired_access_token/...";
....
The above error results from fact that currently your client can't refresh the access token (missing refresh token) and it expires (as can be expected).
Most probably you will need to rewrite your authentication flow to one or other extent. Some time ago offline access was the default. Currently this have to be noted explicitly or you won't receive a refresh token.
Hope this drives you into the right direction.
- Bob S.15Collaborator | Level 9
Thank you - it does help, but I am not sure what I need to do differently? I did change the flow to the new calls, but do I need to do something specifically to store this new short-lived token? The GitHub docs don't seem to indicate that...
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,882 PostsLatest Activity: 3 years agoIf 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 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!