SFSafariViewController for 3rd party passkey authentication

Hi Apple Team,

Can we use SFSafariViewController to launch a 3rd party passkey authentication experience from a native iOS app?

Regards

While SFSafariViewController supports using passkeys to sign in to websites, if you're trying to authenticate your own app via a web sign in (such as OAuth) you'll want to use ASWebAuthenticationSession instead. This will show a managed instance of SFSafariViewController, but also provides APIs for directly completing the authentication with your native code as well.

https://developer.apple.com/documentation/authenticationservices/aswebauthenticationsession

If you were trying to use SFSafariViewController to avoid single-sign on, you can also consider setting prefersEphemeralWebBrowserSession on the session as well.

If you're working with SwiftUI there's a better API available via EnvironmentValues.webAuthenticationSession: https://developer.apple.com/documentation/authenticationservices/webauthenticationsession/

SFSafariViewController for 3rd party passkey authentication
 
 
Q