amplify-flutter icon indicating copy to clipboard operation
amplify-flutter copied to clipboard

Not able to get any exceptions in iOS

Open Sunsiha opened this issue 3 years ago • 51 comments

I have created an application and uploaded to the TestFlight and Appstore also. First time user was able to login and then for next patch release I have uploaded to the TestFlight. Then am not able to signin only. Tried to catch the exception using toast/alert messages, firebase crashlytics. Then connected to the device which i have already installed the app from Testflight. And i run the application in real device tried to see console error, not able to see the exception again. Then i tried with fetchAuthSession didn't get any exception. Am getting only response for

final user = await Amplify.Auth.getCurrentUser();
print('user===${user.userId}');

I was able to get user id. But for all other cognito api's am not getting any exceptions or not even the response.

Software version 15.5 Model iPhone 12

Note: The same code base is working for android device and simulator also.

Sunsiha avatar Jul 06 '22 19:07 Sunsiha

Hello @Sunsiha Thanks for reporting this issue.

Then am not able to signin only. Tried to catch the exception using toast/alert messages

Can you elaborate on this one a bit more?

  • How can you tell you were not able to sign in? Calling a specific auth API? 401'ed on API called etc.?
  • Which API call were you trying to catch possible exception with?

First time user was able to login and then for next patch release I have uploaded to the TestFlight.

  • sign out / re-sign in works as expected in the original version for everyone?
  • What's new in your patch release? (new logic? upgraded dependencies version?)

HuiSF avatar Jul 06 '22 19:07 HuiSF

Hello @HuiSF ,

  1. How can you tell you were not able to sign in? Calling a specific auth API? 401'ed on API called etc.?

When I click on sign in button am calling the following API;

 SignInResult res = await Amplify.Auth.signIn(
          username: usernameController.text.trim(),
          password: passwordController.text.trim());

This am not getting any response or AmplifyException also.

  1. Which API call were you trying to catch possible exception with?
  • signIn
  • fetchAuthSession
 AuthSession res = await Amplify.Auth.fetchAuthSession(
        options: CognitoSessionOptions(getAWSCredentials: true),
      );
  1. sign out / re-sign in works as expected in the original version for everyone?

Signout also not throwing any error. In my code base it's like the same flow only.

  1. What's new in your patch release? (new logic? upgraded dependencies version?) Nothing with cognito. Tried to upgrading this amplify plugin version to 0.6.1 also. But it's not working.

Sunsiha avatar Jul 06 '22 19:07 Sunsiha

This am not getting any response or AmplifyException also.

Do you mean await Amplify.Auth.signIn call never resolves? @Sunsiha

Do sign in and sign out still work in the old version?

HuiSF avatar Jul 06 '22 20:07 HuiSF

@HuiSF No it's not working. I tried. Such a weird issue.

Do sign in and sign out still work in the old version? Nop. To check that only I updated the plugin. But for that also it didn't work.

Sunsiha avatar Jul 06 '22 20:07 Sunsiha

Sorry the information you provided so far doesn't really help me to help you triaging this issue.

  1. Please provide dependencies information following the command listed in this issue report template
  2. I'm a bit confused with your versions. Can you confirm
    1. Do sign in and sign out work in any version of your App? (Please be specific, e.g. 1.0.0 in App Store works, 1.0.1 patch version in TestFlight doesn't work)
    2. If there is working version, what version of dependencies you are using for working version and not work version?
  3. Review your patch version changes, if anything that prevents await Amplify.Auth.signIn from executing?
  4. Review your Amplify App configuration? Have you changed auth category configuration? Have you change anything else that needed amplify push?
  5. Have you tested you patch version in a develop environment? (e.g. in a simulator with debug build) were you able to reproduce this issue?

HuiSF avatar Jul 06 '22 20:07 HuiSF

  1. Have uploaded first version like in 1.0.0 and tried to sign in first time it worked. Again with the same version not able to login. With 1.0.1 version also not working.
  2. Have implemented new features related with the application. No changes related with cognito.
  3. amplifyconfiguration.dart class i didn't do any changes.
  4. As i mentioned it's working in simulator and Android device. No issues with the code base.

Sunsiha avatar Jul 06 '22 20:07 Sunsiha

@HuiSF May b chances are there with like this.

Scenario:

  1. V.1.0.0 I have uploaded with QA environment userpool details. And I didn't log out or uninstall.
  2. V.1.0.1 I have uploaded with stage environment userpool details. And downloaded from Testflight with update option. So when am trying to login I won't be able to catch any exceptions.

Note: After uninstall also the cognito user details may b not clearing.

Sunsiha avatar Jul 06 '22 20:07 Sunsiha

Uninstall App won't clear credentials that are stored in device keychain. If the App bundle id remains the same, it looks up the existing credentials. This could be a cause.

But I need to confirm if anything can cause a silent exception in this scenario.

Can you try to clear the keychain in the testing device see if you can get around of this?

HuiSF avatar Jul 06 '22 21:07 HuiSF

Uninstall App won't clear credentials that are stored in device keychain. If the App bundle id remains the same, it looks up the existing credentials. This could be a cause.

But I need to confirm if anything can cause a silent exception in this scenario.

Can you try to clear the keychain in the testing device see if you can get around of this?

Actually I have changed the end points(Staging to QA) then it worked.

Can you try to clear the keychain in the testing device see if you can get around of this?

This I will again do one more upload with opposite like QA to Staging. Then will confirm you. Will clear the keychain also if i get the issue means.

But I feel this will be the cause. Just do confirm about a silent exception in this case.

Sunsiha avatar Jul 06 '22 21:07 Sunsiha

@HuiSF May b chances are there with like this.

Scenario:

  1. V.1.0.0 I have uploaded with QA environment userpool details. And I didn't log out or uninstall.
  2. V.1.0.1 I have uploaded with stage environment userpool details. And downloaded from Testflight with update option. So when am trying to login I won't be able to catch any exceptions.

Note: After uninstall also the cognito user details may b not clearing.

Yes this is the case.

Sunsiha avatar Jul 06 '22 21:07 Sunsiha

I tested this scenario -

  1. Setup an Amplify App with userpool 1
  2. Signed up a user and signed in, left the user signed in and then uninstalled the App
  3. Created userpool 2, swap out the configuration in the App
  4. When call Amplify.Auth.signIn() below exception was raised
InvalidStateException(message: There is already a user which is signed in. Please log out the user before calling showSignIn., recoverySuggestion: Operation performed is not a valid operation for the current auth state, underlyingException: null)

It looks like this part is working correctly.

HuiSF avatar Jul 06 '22 23:07 HuiSF

I tested this scenario -

  1. Setup an Amplify App with userpool 1
  2. Signed up a user and signed in, left the user signed in and then uninstalled the App
  3. Created userpool 2, swap out the configuration in the App
  4. When call Amplify.Auth.signIn() below exception was raised
InvalidStateException(message: There is already a user which is signed in. Please log out the user before calling showSignIn., recoverySuggestion: Operation performed is not a valid operation for the current auth state, underlyingException: null)

It looks like this part is working correctly.

Yes. This I also used to get. But only when it is like TestFlight/appstore build am not getting any exception. And the scenario which I mentioned.

Sunsiha avatar Jul 07 '22 03:07 Sunsiha

Hi @Sunsiha I tested again with release build today on a physical device.

Test 1:

  1. Build App with userpool 1 config, install and sign in
  2. Uninstall the App without signing out
  3. Reinstall the App with the same userpool config 1 and attempt to sign in the same user, I received exception
InvalidStateException(message: There is already a user which is signed in. Please log out the user before calling showSignIn., recoverySuggestion: Operation performed is not a valid operation for the current auth state, underlyingException: null)

Test 2

  1. Build App with userpool 1 config, install and sign in
  2. Uninstall the App without signing out
  3. Rebuild App with userpool 2 config, install and attempt sign in a user that exists in userpool 2
  4. Sign in succeeded without There is already a user which is signed in exception (this is an expected behavior)

So everything seems working correctly from my testing.

The business logic should remain the same regardless build modes, or how to install the App. Could you double check the set up on your side?

HuiSF avatar Jul 07 '22 19:07 HuiSF

Hi @Sunsiha I tested again with release build today on a physical device.

Test 1:

  1. Build App with userpool 1 config, install and sign in
  2. Uninstall the App without signing out
  3. Reinstall the App with the same userpool config 1 and attempt to sign in the same user, I received exception
InvalidStateException(message: There is already a user which is signed in. Please log out the user before calling showSignIn., recoverySuggestion: Operation performed is not a valid operation for the current auth state, underlyingException: null)

Test 2

  1. Build App with userpool 1 config, install and sign in
  2. Uninstall the App without signing out
  3. Rebuild App with userpool 2 config, install and attempt sign in a user that exists in userpool 2
  4. Sign in succeeded without There is already a user which is signed in exception (this is an expected behavior)

So everything seems working correctly from my testing.

The business logic should remain the same regardless build modes, or how to install the App. Could you double check the set up on your side?

This is happening when I install from TestFlight or Appstore.

Test 1:

  1. Build App with userpool 1 config, upload it to Testflight , install and sign in.
  2. Don't do signout or uninstall.
  3. Build App with userpool 2 config, upload it to Testflight. Update it from TestFlight. Try to login(May be you can keep for alert for to catch exceptions).

And once we do this scenario when we try to do normal debug build I was not able to login. Unless I change to first userpool 1 config.

Sunsiha avatar Jul 08 '22 04:07 Sunsiha

@HuiSF am really not able to find why it is happening. Am getting only some user id when i try to call getuser() API. But when am trying to check that username in cognito userpool am not able to see that user id only. And in other device it's showing some other userid which is present in userpool also.

Sunsiha avatar Jul 24 '22 13:07 Sunsiha

@Sunsiha - Can you please provide the info in the bug report template? I am particularly interested in what version of Amplify-flutter you are using, but having all the info from that template could help in reproducing this issue.

Can you also provide the contents of your ios/Podfile.lock file?

Jordan-Nelson avatar Jul 27 '22 21:07 Jordan-Nelson

@Jordan-Nelson https://github.com/aws-amplify/amplify-flutter/issues/1998

Sunsiha avatar Aug 03 '22 17:08 Sunsiha

Thanks @Sunsiha. Can you also share the contents of your ios/Podfile.lock? As I mentioned on the other issue, there was a known issue in Amplify-ios (which amplify-flutter depends on) where some data would not be cleared when the user pool was switched, causing an issue as you describe. I want to confirm which version of amplify-ios is being used in your project, which will be listed in your Podfile.lock.

Jordan-Nelson avatar Aug 05 '22 13:08 Jordan-Nelson

Thanks @Sunsiha. Can you also share the contents of your ios/Podfile.lock? As I mentioned on the other issue, there was a known issue in Amplify-ios (which amplify-flutter depends on) where some data would not be cleared when the user pool was switched, causing an issue as you describe. I want to confirm which version of amplify-ios is being used in your project, which will be listed in your Podfile.lock.

  - Amplify (1.25.0):
    - Amplify/Default (= 1.25.0)
  - Amplify/Default (1.25.0)
  - amplify_auth_cognito_ios (0.0.1):
    - Amplify (= 1.25.0)
    - amplify_core
    - AmplifyPlugins/AWSCognitoAuthPlugin (= 1.25.0)
    - Flutter
    - ObjectMapper
  - amplify_core (0.0.1):
    - Flutter
    - SwiftFormat/CLI
    - SwiftLint
  - amplify_flutter_ios (0.0.1):
    - Amplify (= 1.25.0)
    - amplify_core
    - AmplifyPlugins/AWSCognitoAuthPlugin (= 1.25.0)
    - AWSPluginsCore (= 1.25.0)
    - Flutter
    - SwiftFormat/CLI
    - SwiftLint
  - AmplifyPlugins/AWSCognitoAuthPlugin (1.25.0):
    - AWSAuthCore (~> 2.27.0)
    - AWSCognitoIdentityProvider (~> 2.27.0)
    - AWSCognitoIdentityProviderASF (~> 2.27.0)
    - AWSCore (~> 2.27.0)
    - AWSMobileClient (~> 2.27.0)
    - AWSPluginsCore (= 1.25.0)
  - AWSAuthCore (2.27.10):
    - AWSCore (= 2.27.10)
  - AWSCognitoIdentityProvider (2.27.10):
    - AWSCognitoIdentityProviderASF (= 2.27.10)
    - AWSCore (= 2.27.10)
  - AWSCognitoIdentityProviderASF (2.27.10):
    - AWSCore (= 2.27.10)
  - AWSCore (2.27.10)
  - AWSMobileClient (2.27.10):
    - AWSAuthCore (= 2.27.10)
    - AWSCognitoIdentityProvider (= 2.27.10)
    - AWSCognitoIdentityProviderASF (= 2.27.10)
    - AWSCore (= 2.27.10)
  - AWSPluginsCore (1.25.0):
    - Amplify (= 1.25.0)
    - AWSCore (~> 2.27.0)

DEPENDENCIES:
  - amplify_auth_cognito_ios (from `.symlinks/plugins/amplify_auth_cognito_ios/ios`)
  - amplify_core (from `.symlinks/plugins/amplify_core/ios`)
  - amplify_flutter_ios (from `.symlinks/plugins/amplify_flutter_ios/ios`)
  
SPEC REPOS:
  trunk:
    - Amplify
    - AmplifyPlugins
    - AWSAuthCore
    - AWSCognitoIdentityProvider
    - AWSCognitoIdentityProviderASF
    - AWSCore
    - AWSMobileClient
    - AWSPluginsCore

EXTERNAL SOURCES:
  amplify_auth_cognito_ios:
    :path: ".symlinks/plugins/amplify_auth_cognito_ios/ios"
  amplify_core:
    :path: ".symlinks/plugins/amplify_core/ios"
  amplify_flutter_ios:
    :path: ".symlinks/plugins/amplify_flutter_ios/ios"

SPEC CHECKSUMS:
  Amplify: 4e1839747f51c5f28f95ce36ef6d356f032b42b7
  amplify_auth_cognito_ios: 8a014f5d5e085265e13a270dc03fbe0818bb1f54
  amplify_core: e67fe0c53845db08aced670bfc7370b1329d2798
  amplify_flutter_ios: 59c43b6b6ff6ccfc59e18eef279d9d6b8fef8cca
  AmplifyPlugins: 110388250aeaf45eaf3008991616be84b2c605f7
 AWSAuthCore: ea9baff143a5ff4a98cea3954b006cedc96cd47e
  AWSCognitoIdentityProvider: 7ef13d7a86298db707165208f01b92997cc3b5af
  AWSCognitoIdentityProviderASF: d745c40a37815ef1c547f9677145d4e522f582f3
  AWSCore: dbad318b7ff0fd86fb8387d3ad1f30049c05bc58
  AWSMobileClient: 523cdb04d21cfd7523eb8db77b2fa2a00b6a95b4
  AWSPluginsCore: c29c4b91c4ecd7376b85288615bb482f409a0b73

Sunsiha avatar Aug 05 '22 14:08 Sunsiha

@Sunsiha - Thank you for providing that.

The issue you are experiencing was fixed in AWSMobileClient (aka aws-sdk-ios) in v2.27.2 (see bug fixes in the release notes: https://github.com/aws-amplify/aws-sdk-ios/releases/tag/2.27.2). Amplify-flutter depends on amplify-ios, and amplify-ios depends on aws-sdk-ios.

Your project seems to have a direct dependency on v2.27.10 of AWSMobileClient ~~and a transitive dependency on v2.27.0. I think the version constraint in amplify-flutter and amplify-ios must not be forcing the latest version to be pulled in. I will look into this.~~

~~As a workaround - Can you try running pod update Amplify AWSPluginsCore AmplifyPlugins from the ios directory, and see if this updates all entries of AWSMobileClient to v2.27.2 or later?~~

With this fix, all credentials should be cleared on startup if the user pool changes.

Edit: See correction below. I will attempt to reproduce this issue with those versions.

Jordan-Nelson avatar Aug 05 '22 17:08 Jordan-Nelson

Apologies for the confusion - I misread the output. The listing for the transitive dependency should not matter here. The actual dependency listing of v2.27.10 should be all that matters. That version should have the fix. I will attempt to reproduce that with those versions.

Jordan-Nelson avatar Aug 05 '22 17:08 Jordan-Nelson

@Sunsiha - I would like to clarify one thing about the versions you are using to make sure that I am attempting to reproduce this with the exact versions you are using. In the other issue your dependencies included amplify_flutter v0.6.1. amplify_flutter v0.6.1 depends on amplify-ios v1.23.0. I can see from your podfile.lock though that you have a dependency on amplify-ios v1.25.0. The version was bumped in amplify_flutter v0.6.2 to 1.25.0. Can you confirm you are still depending on amplify_flutter 0.6.1? You can look for amplify_flutter in your .packages file to find the source and version.

You should see an entry like:

amplify_flutter:file:///Users/<username>/.pub-cache/hosted/pub.dartlang.org/amplify_flutter-0.6.1/lib/

Jordan-Nelson avatar Aug 05 '22 17:08 Jordan-Nelson

Can you also confirm that you are able to reproduce this locally by making no other changes other than the user pool config? I know you mentioned versions uploaded to the App Store and Test Flight. I want to first confirm we can repro this locally since it will be harder to confirm the version in those versions. If we can first figure out how to repro this locally, we can then try to figure out what version those are using.

Jordan-Nelson avatar Aug 05 '22 18:08 Jordan-Nelson

Can you also share your amplify config (with sensitive info removed)? This might be specific to certain sign up mechanism. So far I have been unable to repro this with username based sign in.

Jordan-Nelson avatar Aug 05 '22 18:08 Jordan-Nelson

amplify_flutter

amplify_flutter:file:///Users/sunishaguptan/tools/flutter/.pub-cache/hosted/pub.dartlang.org/amplify_flutter-0.6.4/lib/
amplify_flutter_android:file:///Users/sunishaguptan/tools/flutter/.pub-cache/hosted/pub.dartlang.org/amplify_flutter_android-0.6.4/lib/
amplify_flutter_ios:file:///Users/sunishaguptan/tools/flutter/.pub-cache/hosted/pub.dartlang.org/amplify_flutter_ios-0.6.4/lib/

Sunsiha avatar Aug 05 '22 18:08 Sunsiha

Can you also confirm that you are able to reproduce this locally by making no other changes other than the user pool config? I know you mentioned versions uploaded to the App Store and Test Flight. I want to first confirm we can repro this locally since it will be harder to confirm the version in those versions. If we can first figure out how to repro this locally, we can then try to figure out what version those are using.

It's not happening for me always. For my QA team also not getting always issues. Yesterday I had uploaded a build on the TestFlight. And in that build one QA member not able to login. for other two and for me able to login. Vice versa some times.

But when I get this issue I used to try with all userpool may be in some user pool that used to work.

But switching to the user pool has issue i still have the doubt. Since in my other one which I never use for development and I installed the app and kept from Appstore. With first version i was able to login. Then when I released with new version and after update am not able to.

Sunsiha avatar Aug 05 '22 19:08 Sunsiha

Can you also share your amplify config (with sensitive info removed)? This might be specific to certain sign up mechanism. So far I have been unable to repro this with username based sign in.

const amplifyConfigQA = ''' {
    "UserAgent": "aws-amplify-cli/2.0",
    "Version": "1.0",
    "auth": {
        "plugins": {
            "awsCognitoAuthPlugin": {
                "UserAgent": "aws-amplify-cli/0.1.0",
                "Version": "0.1.0",
                "IdentityManager": {
                    "Default": {}
                },
                "CredentialsProvider": {
                    "CognitoIdentity": {
                        "Default": {
                            "PoolId": "us-east-1:xxxxx-xxx-xxx-xxx-xxxx",
                            "Region": "us-east-1"
                        }
                    }
                },
                "CognitoUserPool": {
                    "Default": {
                        "PoolId": "us-east-1_xxxxx",
                        "AppClientId": "xxxxxx",
                        "Region": "us-east-1"
                    }
                },
                "Auth": {
                    "Default": {
                        "OAuth": {
                            "WebDomain": "xxxx-qa.auth.us-east-1.amazoncognito.com",
                            "AppClientId": "xxxxx",
                            "SignInRedirectURI": "enterprise://",
                            "SignOutRedirectURI": "enterprise://",
                            "Scopes": [
                                "phone",
                                "email",
                                "openid",
                                "profile",
                                "aws.cognito.signin.user.admin"
                            ]
                        },
                        "authenticationFlowType": "USER_SRP_AUTH",
                        "socialProviders": [
                            "FACEBOOK",
                            "GOOGLE",
                            "APPLE"
                        ],
                        "usernameAttributes": [
                            "EMAIL"
                        ],
                        "signupAttributes": [
                            "EMAIL"
                        ],
                        "passwordProtectionSettings": {
                            "passwordPolicyMinLength": 8,
                            "passwordPolicyCharacters": []
                        },
                        "mfaConfiguration": "OFF",
                        "mfaTypes": [
                            "SMS"
                        ],
                        "verificationMechanisms": [
                            "EMAIL"
                        ]
                    }
                }
            }
        }
    }
}''';

/// Dev
const amplifyConfigDev = ''' {
    "UserAgent": "aws-amplify-cli/2.0",
    "Version": "1.0",
    "auth": {
        "plugins": {
            "awsCognitoAuthPlugin": {
                "UserAgent": "aws-amplify-cli/0.1.0",
                "Version": "0.1.0",
                "IdentityManager": {
                    "Default": {}
                },
                "CredentialsProvider": {
                    "CognitoIdentity": {
                        "Default": {
                            "PoolId": "us-east-1:xxxxx-xxx-xxx-xxx-xxxx",
                            "Region": "us-east-1"
                        }
                    }
                },
                "CognitoUserPool": {
                    "Default": {
                        "PoolId": "us-east-1_xxxxx",
                        "AppClientId": "xxxxx",
                        "Region": "us-east-1"
                    }
                },
                "Auth": {
                    "Default": {
                        "OAuth": {
                            "WebDomain": "xxx-service.auth.us-east-1.amazoncognito.com",
                            "AppClientId": "xxxxx",
                            "SignInRedirectURI": "enterprise://",
                            "SignOutRedirectURI": "enterprise://",
                            "Scopes": [
                                "phone",
                                "email",
                                "openid",
                                "profile",
                                "aws.cognito.signin.user.admin"
                            ]
                        },
                        "authenticationFlowType": "USER_SRP_AUTH",
                        "socialProviders": [
                            "FACEBOOK",
                            "GOOGLE",
                            "APPLE"
                        ],
                        "usernameAttributes": [
                            "EMAIL"
                        ],
                        "signupAttributes": [
                            "EMAIL"
                        ],
                        "passwordProtectionSettings": {
                            "passwordPolicyMinLength": 8,
                            "passwordPolicyCharacters": []
                        },
                        "mfaConfiguration": "OFF",
                        "mfaTypes": [
                            "SMS"
                        ],
                        "verificationMechanisms": [
                            "EMAIL"
                        ]
                    }
                }
            }
        }
    }
}''';


///UAT
const amplifyConfigUAT = ''' {
    "UserAgent": "aws-amplify-cli/2.0",
    "Version": "1.0",
    "auth": {
        "plugins": {
            "awsCognitoAuthPlugin": {
                "UserAgent": "aws-amplify-cli/0.1.0",
                "Version": "0.1.0",
                "IdentityManager": {
                    "Default": {}
                },
                "CredentialsProvider": {
                    "CognitoIdentity": {
                        "Default": {
                            "PoolId": "us-east-1:xxxxx-xxx-xxx-xxx-xxxx",
                            "Region": "us-east-1"
                        }
                    }
                },
                "CognitoUserPool": {
                    "Default": {
                        "PoolId": "us-east-1_xxxx",
                        "AppClientId": "xxxx",
                        "Region": "us-east-1"
                    }
                },
                "Auth": {
                    "Default": {
                        "OAuth": {
                            "WebDomain": "xxxx-preprod.auth.us-east-1.amazoncognito.com",
                            "AppClientId": "xxxx",
                            "SignInRedirectURI": "enterprise://",
                            "SignOutRedirectURI": "enterprise://",
                            "Scopes": [
                                "phone",
                                "email",
                                "openid",
                                "profile",
                                "aws.cognito.signin.user.admin"
                            ]
                        },
                        "authenticationFlowType": "USER_SRP_AUTH",
                        "socialProviders": [
                            "FACEBOOK",
                            "GOOGLE",
                            "APPLE"
                        ],
                        "usernameAttributes": [
                            "EMAIL"
                        ],
                        "signupAttributes": [
                            "EMAIL"
                        ],
                        "passwordProtectionSettings": {
                            "passwordPolicyMinLength": 8,
                            "passwordPolicyCharacters": []
                        },
                        "mfaConfiguration": "OFF",
                        "mfaTypes": [
                            "SMS"
                        ],
                        "verificationMechanisms": [
                            "EMAIL"
                        ]
                    }
                }
            }
        }
    }
}''';
/// Prod
const amplifyConfigPROD = ''' {
    "UserAgent": "aws-amplify-cli/2.0",
    "Version": "1.0",
    "auth": {
        "plugins": {
            "awsCognitoAuthPlugin": {
                "UserAgent": "aws-amplify-cli/0.1.0",
                "Version": "0.1.0",
                "IdentityManager": {
                    "Default": {}
                },
                "CredentialsProvider": {
                    "CognitoIdentity": {
                        "Default": {
                            "PoolId": "us-east-1:xxxxx-xxx-xxx-xxx-xxxx",
                            "Region": "us-east-1"
                        }
                    }
                },
                "CognitoUserPool": {
                    "Default": {
                        "PoolId": "us-east-1_xxxxx",
                        "AppClientId": "xxxxx",
                        "Region": "us-east-1"
                    }
                },
                "Auth": {
                    "Default": {
                        "OAuth": {
                            "WebDomain": "xxxx-uat.auth.us-east-1.amazoncognito.com",
                            "AppClientId": "xxxxxx",
                            "SignInRedirectURI": "enterprise://",
                            "SignOutRedirectURI": "enterprise://",
                            "Scopes": [
                                "phone",
                                "email",
                                "openid",
                                "profile",
                                "aws.cognito.signin.user.admin"
                            ]
                        },
                        "authenticationFlowType": "USER_SRP_AUTH",
                        "socialProviders": [
                            "FACEBOOK",
                            "GOOGLE",
                            "APPLE"
                        ],
                        "usernameAttributes": [
                            "EMAIL"
                        ],
                        "signupAttributes": [
                            "EMAIL"
                        ],
                        "passwordProtectionSettings": {
                            "passwordPolicyMinLength": 8,
                            "passwordPolicyCharacters": []
                        },
                        "mfaConfiguration": "OFF",
                        "mfaTypes": [
                            "SMS"
                        ],
                        "verificationMechanisms": [
                            "EMAIL"
                        ]
                    }
                }
            }
        }
    }
}''';

These all I kept it in one amplifyconfiguration.dart class. And in my main class am doing like this;

void _initAmplifyFlutter() async {
    Amplify.addPlugin(AmplifyAuthCognito());
    try {
      await Amplify.configure(ApiServices.DEPLOYMENT_MODE == 'QA'
          ? amplifyConfigQA
          : ApiServices.DEPLOYMENT_MODE == 'UAT'
              ? amplifyConfigUAT
              : ApiServices.DEPLOYMENT_MODE == 'PROD'
                  ? amplifyConfigPROD
                  : amplifyConfigDev);
    } on AmplifyAlreadyConfiguredException {
      print(
          "Amplify was already configured. Looks like app restarted on android/iOS.");
    }
  }

Sunsiha avatar Aug 05 '22 19:08 Sunsiha

@Sunsiha - Do you know what version of Amplify-Flutter is used in the version deployed to the App Store and to the version(s) off the app on Test Flight?

Jordan-Nelson avatar Aug 05 '22 19:08 Jordan-Nelson

@Sunsiha - Do you know what version of Amplify-Flutter is used in the version deployed to the App Store and to the version(s) off the app on Test Flight?

Same what I mentioned. But in all these devices we used older version of amplify too. I mean they have installed the application with older version of amplify. Then when I started getting this kind of issue I updated with 0.6.1.

Sunsiha avatar Aug 05 '22 19:08 Sunsiha

@Sunsiha - Do you know what version of Amplify-Flutter is used in the version deployed to the App Store and to the version(s) off the app on Test Flight?

Same what I mentioned. But in all these devices we used older version of amplify too. I mean they have installed the application with older version of amplify. Then when I started getting this kind of issue I updated with 0.6.1.

Like when I started the application for development i was using this version,

 amplify_flutter: ^0.2.10
 amplify_auth_cognito: ^0.2.10

then the release i done with

amplify_flutter: ^0.4.1
amplify_auth_cognito: ^0.4.1

Then when I got the issue I upgraded with

amplify_flutter: ^0.6.1
amplify_auth_cognito: ^0.6.1

But for testing we all used all these versions too.

Sunsiha avatar Aug 05 '22 19:08 Sunsiha