0

I created new account and uploaded some pictures. I also created Access Token. Users haven't dropbox account and I want to display these pictures in my application. Can I do this without login page?

It works good with login page:

DropboxClientsManager.authorizeFromController(UIApplication.shared,
                                                      controller: self,
                                                      openURL: { (url: URL) -> Void in
                                                      UIApplication.shared.openURL(url)
        })
let client = DropboxClientsManager.authorizedClient

But doesn't work with access token only:

let client = DropboxClient.init(accessToken: "...")

But it doesn't work:

client?.files.download(path: "/pics")
            .response { response, error in
                if let response = response {
                    let responseMetadata = response.0
                    print(responseMetadata)
                    let fileContents = response.1
                    print(fileContents)
                } else if let error = error {
                    print(error)
                }
            }
            .progress { progressData in
                print(progressData)
        }

I got error: Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLKey=https://api-content.dropbox.com/2/files/download, NSErrorFailingURLStringKey=https://api-content.dropbox.com/2/files/download, NSLocalizedDescription=cancelled}

6
  • 1
    You have to login/authorize at least once, then i think you can preserve this authorized client and consume at some later point in time. Commented Mar 6, 2017 at 10:35
  • My application contains some images. Users haven't dropbox account and I must show these images in my application. Can I do this without login page?
    – Kirill
    Commented Mar 6, 2017 at 13:26
  • Perhaps you want to share file(s) with users: dropbox.com/en/help/20 Commented Mar 6, 2017 at 14:18
  • How can I download photo in code without login page?
    – Kirill
    Commented Mar 6, 2017 at 14:55
  • [Cross-linking for reference: dropboxforum.com/t5/API-support/… ]
    – Greg
    Commented Mar 6, 2017 at 18:52

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.