cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
We're back with another cheat sheet to make your 2022 easier than ever! Check out our tips here

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Can't close the page after authentication

Can't close the page after authentication

leninsmannath
Explorer | Level 3

Hi

 

I use the below code for dropbox login

 

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

 

it works perfectly, But after login window, it will ask permission to access the files and folder from dropbox. If I click the allow or cancel button it won't close the window and don't go to OpenURL function in the app delegate.

 

And I checked the "https://github.com/dropbox/SwiftyDropbox" SwiftyDropbox sample code from Github. It works perfectly on it.

 

1 Accepted Solution

Accepted Solutions

Re: Can't close the page after authentication

Greg-DB
Dropboxer

Thanks! I see you don't actually have the "Handle redirect back into SDK" step implemented in your AppDelegate.swift. Please make sure to add that as documented.

 

Also, I noticed from your use of 'UIApplicationSceneManifest' in your Info.plist that this uses scenes, so make sure you also implement the handler in SceneDelegate.swift as noted here.

View solution in original post

8 Replies 8

Re: Can't close the page after authentication

Greg-DB
Dropboxer

Can you confirm you followed all of the instructions for configuring your project and setting up the authorization flow as documented here?

 

For example, make sure you have your "CFBundleURLSchemes" configured with your "db-APPKEYHERE" URL scheme, and that you have the code in place to handle the redirect.

 

Also, do you get any error/output in the console in Xcode?

Re: Can't close the page after authentication

leninsmannath
Explorer | Level 3

Yes, I did this all "CFBundleURLSchemes" configured with your "db-APPKEYHERE" URL scheme, and that you have the code in place to handle the redirect. And it working perfectly.

 

I attach a screenshot. when I click on the allow button the page is not dismissing.

Here is the video url. Please check this.

https://www.dropbox.com/s/p5tm1rb39ol74hx/WhatsApp%20Video%202020-04-21%20at%202.37.32%20PM.mp4?dl=0

 

WhatsApp Image 2020-04-13 at 2.08.53 PM(1).jpeg

 

Re: Can't close the page after authentication

Greg-DB
Dropboxer

Thanks for sharing that. Do you get any errors or output in the console in Xcode though?

 

I see that the action is being submitted and that the SFSafariViewController is attempting to redirect to the custom URL scheme though, as it's momentarily shown in the title bar, so I would expect some error if that fails.

Re: Can't close the page after authentication

leninsmannath
Explorer | Level 3

No error is shown in the Xcode console.

Re: Can't close the page after authentication

Greg-DB
Dropboxer

Thanks for checking that. Can you also check:

Otherwise, please supply a small sample project that reproduces this issue so we can reproduce it here to investigate.

Re: Can't close the page after authentication

leninsmannath
Explorer | Level 3

The dropbox version used is 5.1.0

I created a new project and do the same thing. The issue is still on that app too.

Here is the source code: https://github.com/leninsmannath/DropboxSampleApp

give your dropbox API key and check the above sample project.

 

Thanks

 

Re: Can't close the page after authentication

Greg-DB
Dropboxer

Thanks! I see you don't actually have the "Handle redirect back into SDK" step implemented in your AppDelegate.swift. Please make sure to add that as documented.

 

Also, I noticed from your use of 'UIApplicationSceneManifest' in your Info.plist that this uses scenes, so make sure you also implement the handler in SceneDelegate.swift as noted here.

Re: Can't close the page after authentication

leninsmannath
Explorer | Level 3

Thanks, Greg. It's working cool.

 

I implemented the redirect back into SDK on AppDelegate.swift on original source code, forgot to do in the sample sent to you.

 

But I didn't implement the handler in SceneDelegate.swift.

You already mentioned the https://github.com/dropbox/SwiftyDropbox/issues/259 in your reply. Sorry I didn't check it properly. I apologize for it.

 

Anyway thanks for your patience and support.

Thanks, Greg

 

 

 

 

Who's talking

Top contributors to this post

  • User avatar
    leninsmannath Explorer | Level 3
  • User avatar
    Greg-DB Dropboxer
What do Dropbox user levels mean?
Need more support?