- Newest
- Most votes
- Most comments
The issue you're experiencing with Google Sign-In working on Android but failing on iOS with a UserCancelledException is likely related to the configuration of your iOS app. Here are a few potential causes and solutions to consider:
-
ASWebAuthenticationSession Configuration: On iOS, Amplify uses ASWebAuthenticationSession internally for web-based authentication. There's a possibility that the session is not being configured correctly, leading to the premature cancellation of the sign-in flow.
-
URL Scheme Configuration: While you mentioned that you've registered the custom scheme in the Info.plist file, it's worth double-checking to ensure it exactly matches the scheme expected by your Amplify configuration. Even a small mismatch can cause issues.
-
Amplify Configuration: Ensure that your Amplify configuration for iOS is correct and matches the settings in your Google Developer Console. Pay special attention to the WebDomain, AppClientId, and SignInRedirectURI values.
-
Google Sign-In SDK: If you're using the Google Sign-In SDK directly (rather than through Amplify), make sure it's properly configured for iOS. This includes setting up the correct view controller for the sign-in process.
-
Permissions and Capabilities: Check that your iOS app has the necessary permissions and capabilities enabled in Xcode, such as "Sign In with Apple" capability, which is sometimes required for authentication flows.
-
Private Authentication Sessions: Consider setting the
preferPrivateSession
flag to true usingCognitoSignInWithWebUIPluginOptions
. This can bypass certain permissions dialogs and might resolve the issue, although it may prevent the reuse of existing browser sessions. -
Debugging: Enable more detailed logging in your app to get more information about the error. You might also want to check the CloudWatch logs for your Cognito User Pool to see if there are any issues on the backend.
If the problem persists after checking these points, you may need to compare the configurations between your Android and iOS implementations more closely to identify any discrepancies. Additionally, ensure that you're using compatible versions of AWS Amplify, Flutter, and other related dependencies across both platforms.
Sources
Amplify AUTH - reat native - "An unknown error has occurred" | AWS re:Post
Enable sign-in with web UI - Flutter - AWS Amplify Gen 2 Documentation
AWSGoogleSignInProvider Class Reference
Relevant content
- asked 2 years ago
- asked 3 months ago
- asked 4 months ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 2 years ago