amplify-swift: Ideally, Amplify/Cognito should not use a web view for Sign in with Apple

Describe the bug

Amplify/Cognito use a Web View when displaying the Sign in with Apple native action sheet. Ideally, it would not use this at all.

To Reproduce Steps to reproduce the behavior:

  1. Xcode project configured with Amplify and Cognito plugin. here & here.
  2. Configure AWS Cognito with “Sign In with Apple” as explained here.
  3. Run on a real device.
  4. Tap on ‘Sign In With Apple’ button. which calls
Amplify.Auth.signInWithWebUI(for: .apple, presentationAnchor: window,listener: completionHandler)

A web view is shown that is loading appleid.apple.com, and then the native “Sign in with Apple” action sheet overlay is shown.

Expected behavior

The web view would not be shown at all, it would directly go to the native sheet.

Environment(please complete the following information):

  • Amplify Framework Version: 1.6.1
  • AmplifyPlugins/AWSCognitoAuthPlugin (1.6.1):
  • Dependency Manager: Cocoapods
  • Swift Version: 5.0
  • CLI Version: 4.45.1
  • Include any relevant log output under ~/.amplify/logs/amplify-cli-<issue-date>.log

Device Information (please complete the following information):

  • Device: iPhone 11 Pro
  • iOS Version: 14.4.1

Additional context

The mechanism for this is described in this comment by @palpatim. This could arguably be considered the same bug.

I’m curious if there is a way to use Sign in with Apple without needing to use ASWebAuthenticationSession at all. It leads to a sub-par user experience, and other problems like the blank web view when you cancel the Sign in with Apple process as described in #1027. This would of course necessitate a different API than signInWithWebUI.

When I use a native SwiftUI SignInWithAppleButton the web view isn’t shown at all. I’m not sure if there’s a way for Cognito to “intercept” this though.

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Reactions: 19
  • Comments: 29 (10 by maintainers)

Most upvoted comments

+1 Getting the same issue. Its been a long time, Any update on this?

Any updates on this? This issue is 3 years old now. This is something that should have been implemented a long time ago, no reason why sign-in with Apple has to be a terrible looking web ui for user pools.

Any update? Looking forward this being implemented, especially on Mac where it does not ask for your fingerprint.

Thanks for the feedback. We’ll take this on as a feature request and discuss with the Cognito team. As you identify, it would be a fairly different type of flow from the standard OAuth flow. We’ll update this issue if and when we have any information to share.

I believe this is a cognito feature request, more than it is an amplify request. I don’t see a way to authenticate through direct cognito calls at all using apple tokens, which is what amplify would use.

what amplify COULD do however, is to create a custom flow that accepts apple tokens. and create this feature for customers, before they all leave cognito/amplify for something that actually can pass IOS app store requirements (no web ui sign in is allowed)

Where is the customer obsession and insists on highest standards? this is clearly not meeting the bar.

Hello @luiabrah - we are still discussing this with the Cognito team, we will provide updates when we are confident of our next steps.

Any updates on this issue?

We don’t have any updates to report on this issue at the moment. We are discussing the feature request with Cognito team and will post an update on this issue.

I came across this Auth0 documentation on how they implement Sign in with Apple without a browser-based flow. It shows the sequence diagram that could work. Obviously this would be a lot more effort on your part.