flutter_appauth icon indicating copy to clipboard operation
flutter_appauth copied to clipboard

[iOS] Authorize doesn't return at all when utilizing https redirecUrl & Universal link

Open jannuskool opened this issue 2 years ago • 4 comments

My identity provider only allows https redirect url and I've configured my project (currently focusing only on iOS) to handle iOS Universal links.

I'm able to do authorize call and receive authorization code through the redirectUrl, but I'm not able to utilise the authorization code as the authorize call never returns and browser is kept in front. Therefore I won't receive nonce value nor code verifier.

Is there something I'm missing how AppAuth should behave or get working with https redirect urls (Universal links)?

Is there a way to close the browser manually and receive nonce & code verifier?

jannuskool avatar Nov 09 '24 11:11 jannuskool

I have a very similar problem. After logging in via an custom IDP (callbackurl "https://xxx.xx/") I can't get back to my app. Instead, the callback URL opens in an external Safari window, which does not hold the necessary session and therefore the process cannot be completed. This issue only exists in iOS. The same process works in Android without any problems.

Registering the callback url as a “deeplink” causes the app to come to the foreground, but the link does not reach the custom tab.

Does anyone have an idea what I could be doing wrong?

soumas avatar Nov 12 '24 15:11 soumas

As of iOS 17.4, it is possible to use:

ASWebAuthenticationSession(url: URL, callback: .https(host: String, path: String) { callbackURL,  error in
    if let error = error {
                 result(error)
                 return
            }
    if let callbackURL = callbackURL {
        result(callbackURL.absoluteString)
    }
}

Where result is FlutterResult and the code is called using method channels. Use this function instead of authorize and then issue a token request using the received query parameter code= (from the callback url) as authorizationCode:code

andreasgarvik avatar Mar 23 '25 14:03 andreasgarvik

I have the same issue. Any of you managed to fix it?

tran-huy-phuc avatar Nov 18 '25 05:11 tran-huy-phuc

Same issue here, any solutions ?

encalv avatar Dec 02 '25 13:12 encalv