Forum Discussion

phunction's avatar
phunction
Helpful | Level 5
3 years ago

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

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

Replies have been turned off for this discussion
  • phunction's avatar
    phunction
    Helpful | Level 5
    2 years ago

    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's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    2 years ago

    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's avatar
    phunction
    Helpful | Level 5
    2 years ago

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

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

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!