How to get Password AutoFill to work with ASWebAuthenticationSession?

I have a sample HTML form that follows the password auto-fill requirements. When navigating to the web page without the app, using the built-in Safari app, the native Password AutoFill dialogs for the login and signup forms correctly show:

enter image description here

However, when viewed within the app, the same flow does not trigger the dialog in neither the login or signup submission. It simply dismisses the login/signup screen without any error.

This is how my view controller looks like:

class ViewController: UIViewController {

    @IBAction func didTapLoginButton() {
        let session = ASWebAuthenticationSession(
            url: URL(string: "https://example.com/login.html")!,
            callbackURLScheme: "customscheme") {
                print($0, $1)
        }

        session.prefersEphemeralWebBrowserSession = true
        session.presentationContextProvider = self
        session.start()
    }
}

extension ViewController: ASWebAuthenticationPresentationContextProviding {

    func presentationAnchor(for session: ASWebAuthenticationSession) -> ASPresentationAnchor {
        view.window!
    }
}

Is there a way to make the Password AutoFill to work with the mobile app via ASWebAuthenticationSession? I also tried SFSafariViewController but same issue. I have a sample iOS app here. Any help or experience is greatly appreciated!

Source: Ios