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:



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!

Take a look the password AutoFill Suggestion in the QuickType keyboard suggestion when you tap into one of your username/password fields in ASWebAuthenticationSession. If you have a saved device account in your keychain available for this site, you should see a QuickType keyboard suggestion or a key button to navigate accounts for this domain. What you will not see is the Blue Button that pops up from the bottom of the device suggesting this account for this domain.



Matt Eaton

DTS Engineering, CoreOS

meaton3 at apple.com

Matt, In an ASWebAuthenticationSession, using the default browser, we do not get the prompt to save/store passwords in keychain. Ironically, we DO get the autofill from keychain on subsequent visits IF we have the password stored from a regualr web session in Safari. What are we missing in terms of Saving credentials via the prompt in an ASWebAuthenticationSession?

We're seeing this issue as well.

With ephemeral sessions, iOS does not prompt to create a secure password and does not prompt to save generated passwords. Without ephemeral sessions, it does.

I'm working also with ASWebAuthenticationSession, and prefersEphemeralWebBrowserSession does not affect to show or not the promp to save the password. Basically, as @ArcadianZ said, ASWebAuthenticationSession is not able to show the save password Alert/prompt asking the user to save the user/password in Passwords App.

I'm trying to think why and maybe it's because the save prompt happens on the URL after when it's entered, and in this case it's a redirect to an app URL?

Same problem, any solution found?

How to get Password AutoFill to work with ASWebAuthenticationSession?
 
 
Q