TransWikia.com

Amplify Hosted web-UI sign-in / sign-up call throws error randomly

Stack Overflow Asked by Mashhood Riaz on December 13, 2020

I am using Amplify library for social sign-in / sign-up with Cognito Hosted web UI in iOS and Android applications. We are using Swift UI for iOS.

Sometimes, when a new user tries to sign-in using Facebook or Apple, he receives an error. Then when the user tries again (second time), the flow works fine. The issue is happening randomly on both iOS and Android.

Here’s our code to sign-up/sign-in with AWS.

For iOS:

_ = Amplify.Auth.signInWithWebUI(for: type, presentationAnchor: window!) {
    result in DispatchQueue.main.async {
        switch result {
        case .success:
            self.userID = userId
            completion(true)
        case .failure(let error):
            NotificationBanner.show(error.errorDescription)
            completion(false)
        }
    }
} 

For Android:

Amplify.Auth.signInWithSocialWebUI(provider, activity,
    { callback.onSignInSuccess(result = it, loginType = loginType) },
    { callback.onAuthError(exception = it) }
)

Here’s the error we get when running on iOS:

AuthError: Unexpected error occurred with message: An unknown error occurred

Recovery suggestion: This should not happen. There is a possibility that there is a bug if this error persists. Please take a look at https://github.com/aws-amplify/amplify-ios/issues to see if there are any existing issues that match your scenario, and file an issue with the details of the bug if there isn't. Issue encountered at:

file: /Users/syed.zain/Desktop/parcelx-ios/Pods/Amplify/Amplify/Categories/Auth/Error/AuthError.swift

function: recoverySuggestion

line: 79

Caused by:

Error Domain=com.apple.SafariServices.Authentication Code=1 "(null)"

This error shows up randomly, but frequently. (Our QA team saw it 3 to 4 times in a day.) We are unable to find the exact pattern of its occurrence.

These are the iOS dependencies we’re using:

Amplify (1.3.2):
Amplify/Default (= 1.3.2)
Amplify/Default (1.3.2)
AmplifyPlugins/AWSCognitoAuthPlugin (1.3.2):
AWSAuthCore (~> 2.17.0)
AWSCognitoIdentityProvider (~> 2.17.0)
AWSCognitoIdentityProviderASF (~> 2.17.0)
AWSCore (~> 2.17.0)
AWSMobileClient (~> 2.17.0)
AWSPluginsCore (= 1.3.2)

Dependency Manager: CocoaPods, Swift Package Manager
Swift Version : 5

iOS Device: Tested on iPhone 6S, iPhone 11
iOS Version: Tested on 13.6, 14.0, 14.2

On Android, we’re using Amplify version 1.2.0.

Android Device: Tested on Galaxy A50, Galaxy A51, Samsung Note 8, Pixel 2
Android Version: Tested on versions greater than 7.0

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP