Your workflow is unique 👨‍💻 -  tell us how you use Dropbox here.

Forum Discussion

caliqdev's avatar
caliqdev
New member | Level 2
9 years ago

SwiftyDropbox Getting token when handling return URL

Writen an app which needs to connect to multiple drobox account so following the instructions here

http://dropbox.github.io/SwiftyDropbox/api-docs/latest/

 

I am handling the return URL after authorising and the page says

 

  • "at this point, the app that is integrating with the SDK should persistently save the tokenUid from the DropboxAccessToken field of the DropboxOAuthResult object returned from the handleRedirectURL(or handleRedirectURLTeam) method"

I am struggling to make this work and to come up with the correct code other than the standard below. Can anyone advise how i get the token returned please?

 

        if let authResult = DropboxClientsManager.handleRedirectURL(url)

        {

            switch authResult

            {

            case .success:

                print("Success! User is logged into Dropbox.")

            case .cancel:

                print("Authorization flow was manually canceled by user!")

            case .error(_, let description):

                print("Error: \(description)")

            }

        }

1 Reply

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

    You can get the token/uid from the success result like this:

     

    case .success(let token):
        print("Success! User  \(token.uid) is logged into Dropbox.")

     

    Hope this helps! 

About Dropbox API Support and Feedback

Node avatar for Dropbox API Support and Feedback
Get help with the Dropbox API from fellow developers and experts.

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!