Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
I am using ObjectiveDropboxOfficial for my ios objective c project.
Everything is working fine except logout.
Here is the problem,
Step 1: Logged into dropbox.
Step 2: Logged out from dropbox.
Step 3: Trying to login again. It should ask me for login credentials because, i already logged out from dropbox which is not happening. Instead, it directly takes me to after login process screen. I attached the screenshot for that screen below.
https://drive.google.com/file/d/14887FaYrUoZZ5fwzbDXSHa0LHEWggqhn/view?usp=sharing
I tried all the possibilities that were given in the sdk, nothing helps.
Here is the code to logout from dropbox
[[ODBoxHandler sharedHandler] clientRequestedLogout];
Cleared cache from browser
[[NSURLCache sharedURLCache] removeAllCachedResponses];
NSHTTPCookieStorage *cookieJar = [NSHTTPCookieStorage sharedHTTPCookieStorage];
for(NSHTTPCookie *cookie in [cookieJar cookies]) {
NSLog(@"Cookies attached: %@", cookie.description);
if(cookie){
[cookieJar deleteCookie:cookie];
}
}
Cleared saved access token from keychain and dropbox.
[DBSDKKeychain clearAllTokens];
[DBClientsManager unlinkAndResetClients];
Dropbox sdk internally uses SFSafariViewController, where the cache is not cleared until i close the app and reopen again.
Any suggestions would be greatly helpful.
As you mentioned, when processing the OAuth app authorization flow in an app using ObjectiveDropboxOfficial, SFSafariViewController is used. The web session in SFSafariViewController (such as whether the user is already signed in to www.dropbox.com) is separate from whether or not the ObjectiveDropboxOfficial SDK has any locally stored access/refresh tokens. The clearAllTokens and unlinkAndResetClients methods only affect the locally stored access/refresh tokens, not the web session, so calling those won't sign the user out of the Dropbox web site.
Also, ODBoxHandler isn't made by Dropbox so I can't help with that, but if you're referring to this third party library, it looks like that clientRequestedLogout method just calls unlinkAndResetClients too.
Likewise, while I can't provide support for NSURLCache as that's not made by Dropbox, it sounds like it's not possible to clear the SFSafariViewController session using NSURLCache. For instance, I found this post that indicates it's not possible to interact with or clear SFSafariViewController credentials.
So, it looks like it's not possible to proactively clear out the entire SFSafariViewController session directly. You could clear the cookies for www.dropbox.com in SFSafariViewController however by presenting a SFSafariViewController for the URL "https://www.dropbox.com/logout", though that's not part of the API/SDK, so ObjectiveDropboxOfficial doesn't offer a method for that. Doing so from your own code should work, though it would involve showing the SFSafariViewController UI again.
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!