cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Share your feedback on the Document Scanning Experience in the Dropbox App right 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: 

iOS 17.x can no longer login and allow dropbox access on app

iOS 17.x can no longer login and allow dropbox access on app

phunction
Explorer | Level 4

i, something has changed with iOS 17.  My app is using the DropboxClient() api to get an auth token, which would show safari and ask for a login.

The login works, and they will get the question if they want to allow my app access. When they click on Allow, they now get the error:

Safari can't open the page because it couldn't connect to the server.

 

I was using the redirect uri of "http://localhost/authorize"

 

 

 

private const string RedirectUri = "http://localhost/authorize";
var authorizeUri = DropboxOAuth2Helper.GetAuthorizeUri(OAuthResponseType.Code, appKey, RedirectUri, state: state, tokenAccessType: TokenAccessType.Offline);

 

 

 

 

This was working fine until iOS 17 came out. 

Does anyone know how to fix this? It appears that iOS 17 no longer allows safari to connect to localhost?

 

I am using c# (xamarin/maui) for iOS.

13 Replies 13

Greg-DB
Dropbox Staff

@phunction The particular error message you shared here is referring to the redirect URI not being registered for the app; it isn't referring to the protocol (such as "https://" or "myapp://").

 

Whether using PKCE or not, the redirect URI value (the "pkceuri" variable in your code) must exactly match one of the redirect URIs registered for the app (based on the app key being used, the "appKey" variable in your code) on the App Console. If the redirect URI does not match exactly, you'll get that error message. To fix that, sign in to the account that owns the app (if you're not already) and register the relevant redirect URI using the "OAuth 2" "Redirect URIs" section of the app's page on the App Console.

 

It may be helpful to print out the values of "appKey" and "pkceuri" to double check you're registering the exact redirect URI for the relevant app.

phunction
Explorer | Level 4

I have my pkce redirect setup at    mytestapp://oauth2redirect

 

I entered that into the app console (I was mistaken that the uri had to have https:)

 

When I send the request, I now get the page asking if I want to authorize the app, when I say ok, it just gives me a string to enter into my app, it does not appear to automatically redirect.

Does this work when debugging? 

I am not sure how the redirect works, when the browser opens and you authorize, does the browser now send back a message to iOS with the redirect URI, and iOS should see that the app has registered that uri in the info.plist then pass the returned info to the app?

Greg-DB
Dropbox Staff

The redirect URI functionality works the same way regardless of whether you're debugging or if your app is in development or production status.

 

If the authorization page is showing the authorization code to the user on the authorization page (with a message like "Enter this code into ... to finish the process") then that means that a redirect URI wasn't used. If that's not what you intended, make sure you're still setting a redirect URI when building the authorization URI.

And yes, when using a redirect URI, after the user authorizes the app, Dropbox will redirect the user's browser to the specified redirect URI with the authorization code included. When using a custom URI scheme (like "myapp://" or "mytestapp://" in your examples), the browser and operating system handle that redirect to send it to the right place. For example, as you said, iOS would see which app has that particular scheme registered and would send that redirect to that app.

 

phunction
Explorer | Level 4

Turns out I has an extra space in my  auth uri.

I have it working now, thanks for all the help.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    phunction Explorer | Level 4
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?