Tim Walsh
Tim Walsh

Reputation: 1105

iOS Authorize Dropbox without opening Dropbox app

Is there a way to iOS Authorize Dropbox without opening Dropbox app if it is installed. Just open the Dropbox webview. You were able to do this for facebook authentication, I was hoping there is a option I can set to not open the dropbox app.

I found the auth api logic https://www.dropbox.com/developers/core/api#authorize

Not sure how you would implement it for iOS.

Thanks,

Upvotes: 1

Views: 1709

Answers (2)

Tim Walsh
Tim Walsh

Reputation: 1105

I was able to get around this by checking if Drop box is installed and changing the call based off that.

    NSURL *dropboxUrl = [NSURL URLWithString:@"dbapi-1://"];
    if ([[UIApplication sharedApplication] canOpenURL:dropboxUrl]) {
        [[DBSession sharedSession] linkUserId:@"" fromController:vc];
    }else{
        [[DBSession sharedSession] linkFromController:vc];
    }

If the user has dropbox installed, then it will open safari and validate the user that way.

Not the cleanest solution, but the best solution without adding any more 3rd party libs.

Upvotes: 2

Madbreaks
Madbreaks

Reputation: 19549

I asked a question in the comments up there, and your answer may or may not render this answer invalid but here you go: You can leverage Dropbox's own iOS SDK to authenticate the current user. This is probably preferable to using the /authentication REST endpoint.

Another option which may very well make life easier is to use Temboo's iOS SDK (full disclosure: I work for Temboo). It allows you to work with Dropbox's API very easily in your iOS app, and your Temboo account tools additionally handle a lot of the heavy lifting around OAuth, credentials, etc. There are 100+ other APIs the Temboo SDK can talk to as well, and once you've implemented one integrating with other APIs is a breeze.

Cheers

Upvotes: 0

Related Questions