Skip to content

Allow choosing between SFSafariViewController and ASWebAuthenticationSession for signInWithWebUI #3964

@Kirvlawc

Description

@Kirvlawc

Is your feature request related to a problem? Please describe.

According to the documentation, Amplify.Auth.signInWithWebUI automatically uses ASWebAuthenticationSession on iOS 13.0+ and falls back to SFAuthenticationSession for older versions.

The problem with this approach is that it assumes all use cases require data sharing between the app and Safari. However, some scenarios actually prefer keeping authentication data isolated within the app, relying on SFSafariViewController cookies instead.

In my use case, this default behavior causes session continuity issues. After logging in, when users open web views within the app, they are forced to log in again because SFSafariViewController doesn’t have access to Safari’s cookies. This disrupts the user experience and limits the flexibility of authentication flows.

Describe the solution you'd like

Would it be possible to provide an option to use SFSafariViewController instead of ASWebAuthenticationSession for signInWithWebUI? This would allow developers to choose the most appropriate authentication method based on their app’s needs.

Describe alternatives you've considered

Opening webviews with ASWebAuthenticationSession

While using ASWebAuthenticationSession does provide access to Safari’s cookies—ensuring session continuity—it results in a suboptimal user experience. This is because every time an ASWebAuthenticationSession is opened, Apple forces the user to interact with a system prompt, even for standard web browsing. This disrupts the user flow and makes it impractical for scenarios where seamless navigation between authenticated web content is needed.

Is the feature request related to any of the existing Amplify categories?

Auth

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    authIssues related to the Auth categoryfeature-requestRequest a new feature

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions