1
votes

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,

2
Can you clarify - is the problem that you don't know how to "hand off" the authenticated session to the webview, or that you don't know how to authenticate the user outside of the webview in the first place? - Madbreaks
The problem is that if the user has the dropbox app installed, I don't want the "[[DBSession sharedSession] linkFromController:self];" to open the dropbox app. I want the authentication to use the webview. - Tim Walsh
@TimWalsh, did you ever find a reasonable way to do this? - Andy Ibanez
I put this on the back burner, but looks like the API will allow you to write your own login page. I will end up doing that instead of adding another 3rd party library like Temboo. - Tim Walsh

2 Answers

2
votes

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.

0
votes

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