We Want to Hear From You! What Do You Want to See on the Community? Tell us here!

Forum Discussion

Lukasz_Nestor's avatar
Lukasz_Nestor
Explorer | Level 4
5 years ago

iOS SwiftyDropbox - login problem

Hello,

 

I'm trying to integrate SwiftyDropbox (newest version 7.0.1 built as xcframework, running on iPad/iPhone with iOS 14.6) into my application ExplainEverything (current store version uses old version of Dropbox SDK - ObjectiveDropboxOfficial 3.7.0 and it works without any problems).

I have problem with the authorizing with SwiftyDropbox. I'm using the following code to login:
```

            let scopeRequest = ScopeRequest(scopeType: .user,

                                            scopes: ["files.metadata.read", "files.content.read", "files.content.write", "account_info.read"],

                                            includeGrantedScopes: false)

 

            DropboxClientsManager.authorizeFromControllerV2(

                UIApplication.shared,

                controller: controller,

                loadingStatusDelegate: nil,

                openURL: { url in UIApplication.shared.open(url, options: [:], completionHandler: nil) },

                scopeRequest: scopeRequest

            )
```
For logout I use:
```

        DropboxClientsManager.unlinkClients()
```

It works fine for the first time. The authorizing is successfull and all another requests works also properly, e.g. listing folders, download/upload file. But if I logout and then try to login again, the SDK returns error - `SwiftyDropbox.OAuth2Error error 11. The operation couldn't be completed.  `. The next try is successful and the next next try returns error. So it works like: success, failure, sucess, failure, ...

The error occurs if I have Dropbox application installed on my device (official app from App Store). So the login process uses this app.

It doesn't occur without this application being installed (the SDK uses internally SFSafariViewController then). 

Can You give me some advice what I'm doing wrong or is this some kind of known issue?
Thanks, Łukasz

3 Replies

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    5 years ago

    Thanks for the detailed report! We'll look into it.

  • Lukasz_Nestor's avatar
    Lukasz_Nestor
    Explorer | Level 4
    5 years ago

    Update:

    The problem occurs if I make the mentioned steps quickly: login, logout, login, ...

    It works properly if I wait few seconds (5-10s) before trying to login next time. 

    Also the problem doesn't occur on every device, e.g. on iPad Pro 9,7'' (2016) or iPad Air (2013) it doesn't occur. But it occurs for example on the following devices: iPad Pro 12.9'' 4th gen (2020), iPad Pro 10.5'' (2017), iPhone 7 plus, iPhone 6 plus. (all mentioned devices with newest iOS 14.6)

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    5 years ago

    Thanks for following up with the additional information!

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.6,036 PostsLatest Activity: 3 days ago
412 Following

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 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!