aws-amplify / aws-sdk-android

AWS SDK for Android. For more information, see our web site:
https://docs.amplify.aws
Other
1.03k stars 549 forks source link

AWSMobileClient.getInstance().showSignIn() buttons do not work after sign-out or invalid token #1003

Closed BillBunting closed 3 years ago

BillBunting commented 5 years ago

Describe the bug When a user needs to sign-in the Auth UI sign-in screen is displayed, but, in some cases, the showSignIn screen's buttons may be clicked, give "click" visual feedback, but do not do anything and the user remains on the sign-in screen. The user is unable to sign back in until deleting the app and reinstalling or, in some cases, by terminating the app and restarting it. Clicking on buttons in the sign-in screen does nothing.

clicking the Facebook or Google or Sign-in (username/password) buttons has not affect nor does it generate any logging other than the following two lines

2019-06-02 00:30:13.909 14818-14818/com.buntingsoftware.modlist D/ViewRootImpl@3091f8e[SignInActivity]: ViewPostImeInputStage processPointer 0
2019-06-02 00:30:14.007 14818-14818/com.buntingsoftware.modlist D/ViewRootImpl@3091f8e[SignInActivity]: ViewPostImeInputStage processPointer 1

To Reproduce A code sample or steps:

AWSMobileClient.getInstance().showSignIn(
                        MainActivity.this,
                        SignInUIOptions.builder()
                                .nextActivity(MainActivity.class)
                                .logo(R.drawable.ic_modlist_aws_signin_icon)
                                .backgroundColor(Color.parseColor("#7FA7BC"))
                                .canCancel(false)
                                .build(),
                        new Callback<UserStateDetails>() {

Next, call AWSMobileClient.getInstance().signOut(); or allow a token to expire (which will force the login screen to appear). In some cases, the bug is triggered and the sign-in buttons no longer do anything.

Which AWS service(s) are affected? aws-android-sdk-auth-ui

Expected behavior Buttons should be clickable and sign-in the user.

Environment Information (please complete the following information):

BillBunting commented 5 years ago

Currently testing in 2.13.1, and I don't seem to be able to reproduce the issue. The problem seems to have started since 2.13.1 and was noted specifically in 2.13.5.

BillBunting commented 5 years ago

I continue to observe the behavior documented in this issue, even after upgrading to 2.14.2. It may be related to a token or other timeout issue. It works some of the time, but after a long period of time, the SignIn UI buttons stop working as described previously following a sign-out.

BillBunting commented 5 years ago

Here is another use case that demonstrates the issue. When the token is expired. Presenting the sign-in has buttons that don't work properly. This was a user that upgraded from AWS 2.13.1 to 2.14.2.

2019-08-20 12:30:21.989 16103-16155/com.buntingsoftware.modlist W/AWSMobileClient: Failed to federate the tokens.
    com.amazonaws.services.cognitoidentity.model.NotAuthorizedException: Invalid login token. Couldn't verify signed token. (Service: AmazonCognitoIdentity; Status Code: 400; Error Code: NotAuthorizedException; Request ID: cedf9e87-c367-11e9-87d6-9fc4b0d5ea9f)
        at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:730)
        at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:405)
        at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:212)
        at com.amazonaws.services.cognitoidentity.AmazonCognitoIdentityClient.invoke(AmazonCognitoIdentityClient.java:1729)
        at com.amazonaws.services.cognitoidentity.AmazonCognitoIdentityClient.getCredentialsForIdentity(AmazonCognitoIdentityClient.java:751)
        at com.amazonaws.auth.CognitoCredentialsProvider.populateCredentialsWithCognito(CognitoCredentialsProvider.java:782)
        at com.amazonaws.auth.CognitoCredentialsProvider.startSession(CognitoCredentialsProvider.java:694)
        at com.amazonaws.auth.CognitoCredentialsProvider.refresh(CognitoCredentialsProvider.java:631)
        at com.amazonaws.auth.CognitoCachingCredentialsProvider.refresh(CognitoCachingCredentialsProvider.java:510)
        at com.amazonaws.auth.CognitoCachingCredentialsProvider.getIdentityId(CognitoCachingCredentialsProvider.java:452)
        at com.amazonaws.auth.CognitoCredentialsProvider.populateCredentialsWithCognito(CognitoCredentialsProvider.java:776)
        at com.amazonaws.auth.CognitoCredentialsProvider.startSession(CognitoCredentialsProvider.java:694)
        at com.amazonaws.auth.CognitoCredentialsProvider.refresh(CognitoCredentialsProvider.java:631)
        at com.amazonaws.auth.CognitoCachingCredentialsProvider.refresh(CognitoCachingCredentialsProvider.java:510)
        at com.amazonaws.mobile.client.AWSMobileClient.federateWithCognitoIdentity(AWSMobileClient.java:1514)
        at com.amazonaws.mobile.client.AWSMobileClient.getUserStateDetails(AWSMobileClient.java:1007)
        at com.amazonaws.mobile.client.AWSMobileClient.waitForSignIn(AWSMobileClient.java:906)
        at com.amazonaws.mobile.client.AWSMobileClient.getCredentials(AWSMobileClient.java:358)
        at com.amazonaws.mobile.client.AWSMobileClient$1.run(AWSMobileClient.java:407)
        at com.amazonaws.mobile.client.AWSMobileClient$1.run(AWSMobileClient.java:404)
        at com.amazonaws.mobile.client.internal.ReturningRunnable$1.run(ReturningRunnable.java:44)
        at java.lang.Thread.run(Thread.java:764)
2019-08-20 12:30:21.989 16103-16155/com.buntingsoftware.modlist D/AWSMobileClient: waitForSignIn: userState:SIGNED_OUT_FEDERATED_TOKENS_INVALID
2019-08-20 12:30:22.473 16103-16166/com.buntingsoftware.modlist W/AWSMobileClient: Failed to federate the tokens.
    com.amazonaws.services.cognitoidentity.model.NotAuthorizedException: Invalid login token. Couldn't verify signed token. (Service: AmazonCognitoIdentity; Status Code: 400; Error Code: NotAuthorizedException; Request ID: cf3c15d2-c367-11e9-a739-49e777685918)
        at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:730)
        at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:405)
        at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:212)
        at com.amazonaws.services.cognitoidentity.AmazonCognitoIdentityClient.invoke(AmazonCognitoIdentityClient.java:1729)
        at com.amazonaws.services.cognitoidentity.AmazonCognitoIdentityClient.getCredentialsForIdentity(AmazonCognitoIdentityClient.java:751)
        at com.amazonaws.auth.CognitoCredentialsProvider.populateCredentialsWithCognito(CognitoCredentialsProvider.java:782)
        at com.amazonaws.auth.CognitoCredentialsProvider.startSession(CognitoCredentialsProvider.java:694)
        at com.amazonaws.auth.CognitoCredentialsProvider.refresh(CognitoCredentialsProvider.java:631)
        at com.amazonaws.auth.CognitoCachingCredentialsProvider.refresh(CognitoCachingCredentialsProvider.java:510)
        at com.amazonaws.auth.CognitoCachingCredentialsProvider.getIdentityId(CognitoCachingCredentialsProvider.java:452)
        at com.amazonaws.auth.CognitoCredentialsProvider.populateCredentialsWithCognito(CognitoCredentialsProvider.java:776)
        at com.amazonaws.auth.CognitoCredentialsProvider.startSession(CognitoCredentialsProvider.java:694)
        at com.amazonaws.auth.CognitoCredentialsProvider.refresh(CognitoCredentialsProvider.java:631)
        at com.amazonaws.auth.CognitoCachingCredentialsProvider.refresh(CognitoCachingCredentialsProvider.java:510)
        at com.amazonaws.mobile.client.AWSMobileClient.federateWithCognitoIdentity(AWSMobileClient.java:1514)
        at com.amazonaws.mobile.client.AWSMobileClient.getUserStateDetails(AWSMobileClient.java:1007)
        at com.amazonaws.mobile.client.AWSMobileClient$26.run(AWSMobileClient.java:2925)
        at com.amazonaws.mobile.client.internal.InternalCallback$1.run(InternalCallback.java:101)
        at java.lang.Thread.run(Thread.java:764)
2019-08-20 12:30:22.504 16103-16166/com.buntingsoftware.modlist D/SignInUI: User is not signed-in. Presenting the SignInUI.
2019-08-20 12:30:22.504 16103-16166/com.buntingsoftware.modlist D/SignInUI: Presenting the SignIn UI.
2019-08-20 12:30:22.542 16103-16166/com.buntingsoftware.modlist I/oftware.modlis: IncrementDisableThreadFlip blocked for 16.110ms
2019-08-20 12:30:22.596 16103-16132/com.buntingsoftware.modlist V/FA: Recording user engagement, ms: 2925
2019-08-20 12:30:22.618 16103-16103/com.buntingsoftware.modlist W/ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@27bea9c
2019-08-20 12:30:22.660 16103-16115/com.buntingsoftware.modlist I/oftware.modlis: Background concurrent copying GC freed 21664(1694KB) AllocSpace objects, 8(160KB) LOS objects, 50% free, 2MB/4MB, paused 16.039ms total 136.038ms
2019-08-20 12:30:22.675 16103-16103/com.buntingsoftware.modlist V/FA: onActivityCreated
2019-08-20 12:30:22.704 16103-16132/com.buntingsoftware.modlist V/FA: Activity paused, time: 21653777
2019-08-20 12:30:22.802 16103-16103/com.buntingsoftware.modlist D/SignInView: Using defaults: backgroundColor = -12303292; logoResId = 2131230863
2019-08-20 12:30:22.803 16103-16103/com.buntingsoftware.modlist D/SignInView: Background Color : -8411204
2019-08-20 12:30:22.803 16103-16103/com.buntingsoftware.modlist D/SignInView: Logo : 2131230884
2019-08-20 12:30:22.809 16103-16132/com.buntingsoftware.modlist D/FA: Logging event (FE): user_engagement(_e), Bundle[{firebase_event_origin(_o)=auto, engagement_time_msec(_et)=2925, firebase_screen_class(_sc)=MainActivity, firebase_screen_id(_si)=-813387870987563676}]
2019-08-20 12:30:22.830 16103-16103/com.buntingsoftware.modlist D/SignInView: Trying to create an instance of UserPoolSignInView
2019-08-20 12:30:23.041 16103-16103/com.buntingsoftware.modlist W/System.err: java.lang.IllegalArgumentException: No such provider : com.amazonaws.mobile.auth.facebook.FacebookSignInProvider
2019-08-20 12:30:23.041 16103-16103/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.core.signin.SignInManager.findProvider(SignInManager.java:273)
2019-08-20 12:30:23.042 16103-16103/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.core.signin.SignInManager.initializeSignInButton(SignInManager.java:261)
2019-08-20 12:30:23.042 16103-16103/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.facebook.FacebookButton.<init>(FacebookButton.java:108)
2019-08-20 12:30:23.042 16103-16103/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.facebook.FacebookButton.<init>(FacebookButton.java:76)
2019-08-20 12:30:23.043 16103-16103/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.facebook.FacebookButton.<init>(FacebookButton.java:66)
2019-08-20 12:30:23.043 16103-16103/com.buntingsoftware.modlist W/System.err:     at java.lang.reflect.Constructor.newInstance0(Native Method)
2019-08-20 12:30:23.043 16103-16103/com.buntingsoftware.modlist W/System.err:     at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
2019-08-20 12:30:23.043 16103-16103/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.ui.SignInView.createDependencyObject(SignInView.java:421)
2019-08-20 12:30:23.043 16103-16103/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.ui.SignInView.addSignInButtonsToView(SignInView.java:502)
2019-08-20 12:30:23.043 16103-16103/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.ui.SignInView.setUpSignInButtons(SignInView.java:282)
2019-08-20 12:30:23.044 16103-16103/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.ui.SignInView.<init>(SignInView.java:317)
2019-08-20 12:30:23.044 16103-16103/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.ui.SignInView.<init>(SignInView.java:159)
2019-08-20 12:30:23.044 16103-16103/com.buntingsoftware.modlist W/System.err:     at java.lang.reflect.Constructor.newInstance0(Native Method)
2019-08-20 12:30:23.044 16103-16103/com.buntingsoftware.modlist W/System.err:     at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
2019-08-20 12:30:23.044 16103-16103/com.buntingsoftware.modlist W/System.err:     at android.view.LayoutInflater.createView(LayoutInflater.java:647)
2019-08-20 12:30:23.044 16103-16103/com.buntingsoftware.modlist W/System.err:     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
2019-08-20 12:30:23.044 16103-16103/com.buntingsoftware.modlist W/System.err:     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
2019-08-20 12:30:23.044 16103-16103/com.buntingsoftware.modlist W/System.err:     at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
2019-08-20 12:30:23.045 16103-16103/com.buntingsoftware.modlist W/System.err:     at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
2019-08-20 12:30:23.045 16103-16103/com.buntingsoftware.modlist W/System.err:     at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
2019-08-20 12:30:23.045 16103-16103/com.buntingsoftware.modlist W/System.err:     at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:532)
2019-08-20 12:30:23.045 16103-16103/com.buntingsoftware.modlist W/System.err:     at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:161)
2019-08-20 12:30:23.045 16103-16103/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.ui.SignInActivity.onCreate(SignInActivity.java:113)
2019-08-20 12:30:23.045 16103-16103/com.buntingsoftware.modlist W/System.err:     at android.app.Activity.performCreate(Activity.java:7136)
2019-08-20 12:30:23.046 16103-16103/com.buntingsoftware.modlist W/System.err:     at android.app.Activity.performCreate(Activity.java:7127)
2019-08-20 12:30:23.046 16103-16103/com.buntingsoftware.modlist W/System.err:     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
2019-08-20 12:30:23.046 16103-16103/com.buntingsoftware.modlist W/System.err:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
2019-08-20 12:30:23.046 16103-16103/com.buntingsoftware.modlist W/System.err:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
2019-08-20 12:30:23.046 16103-16103/com.buntingsoftware.modlist W/System.err:     at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
2019-08-20 12:30:23.046 16103-16103/com.buntingsoftware.modlist W/System.err:     at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
2019-08-20 12:30:23.050 16103-16103/com.buntingsoftware.modlist W/System.err:     at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
2019-08-20 12:30:23.050 16103-16103/com.buntingsoftware.modlist W/System.err:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
2019-08-20 12:30:23.050 16103-16103/com.buntingsoftware.modlist W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:106)
2019-08-20 12:30:23.050 16103-16103/com.buntingsoftware.modlist W/System.err:     at android.os.Looper.loop(Looper.java:193)
2019-08-20 12:30:23.051 16103-16103/com.buntingsoftware.modlist W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:6669)
2019-08-20 12:30:23.052 16103-16103/com.buntingsoftware.modlist W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
2019-08-20 12:30:23.054 16103-16103/com.buntingsoftware.modlist W/System.err:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
2019-08-20 12:30:23.055 16103-16103/com.buntingsoftware.modlist W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
2019-08-20 12:30:23.055 16103-16103/com.buntingsoftware.modlist E/FacebookButton: Cannot initialize the SignInButton. Please check if IdentityManager :  startUpAuth and setUpToAuthenticate are invoked
2019-08-20 12:30:23.067 16103-16103/com.buntingsoftware.modlist W/System.err: java.lang.IllegalArgumentException: No such provider : com.amazonaws.mobile.auth.google.GoogleSignInProvider
2019-08-20 12:30:23.068 16103-16103/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.core.signin.SignInManager.findProvider(SignInManager.java:273)
2019-08-20 12:30:23.068 16103-16103/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.core.signin.SignInManager.initializeSignInButton(SignInManager.java:261)
2019-08-20 12:30:23.068 16103-16103/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.google.GoogleButton.<init>(GoogleButton.java:108)
2019-08-20 12:30:23.068 16103-16103/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.google.GoogleButton.<init>(GoogleButton.java:77)
2019-08-20 12:30:23.068 16103-16103/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.google.GoogleButton.<init>(GoogleButton.java:67)
2019-08-20 12:30:23.068 16103-16103/com.buntingsoftware.modlist W/System.err:     at java.lang.reflect.Constructor.newInstance0(Native Method)
2019-08-20 12:30:23.069 16103-16103/com.buntingsoftware.modlist W/System.err:     at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
2019-08-20 12:30:23.069 16103-16103/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.ui.SignInView.createDependencyObject(SignInView.java:421)
2019-08-20 12:30:23.071 16103-16103/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.ui.SignInView.addSignInButtonsToView(SignInView.java:502)
2019-08-20 12:30:23.071 16103-16103/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.ui.SignInView.setUpSignInButtons(SignInView.java:282)
2019-08-20 12:30:23.072 16103-16103/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.ui.SignInView.<init>(SignInView.java:317)
2019-08-20 12:30:23.072 16103-16103/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.ui.SignInView.<init>(SignInView.java:159)
2019-08-20 12:30:23.072 16103-16103/com.buntingsoftware.modlist W/System.err:     at java.lang.reflect.Constructor.newInstance0(Native Method)
2019-08-20 12:30:23.072 16103-16103/com.buntingsoftware.modlist W/System.err:     at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
2019-08-20 12:30:23.072 16103-16103/com.buntingsoftware.modlist W/System.err:     at android.view.LayoutInflater.createView(LayoutInflater.java:647)
2019-08-20 12:30:23.072 16103-16103/com.buntingsoftware.modlist W/System.err:     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790)
2019-08-20 12:30:23.073 16103-16103/com.buntingsoftware.modlist W/System.err:     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
2019-08-20 12:30:23.073 16103-16103/com.buntingsoftware.modlist W/System.err:     at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
2019-08-20 12:30:23.073 16103-16103/com.buntingsoftware.modlist W/System.err:     at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
2019-08-20 12:30:23.073 16103-16103/com.buntingsoftware.modlist W/System.err:     at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
2019-08-20 12:30:23.073 16103-16103/com.buntingsoftware.modlist W/System.err:     at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:532)
2019-08-20 12:30:23.073 16103-16103/com.buntingsoftware.modlist W/System.err:     at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:161)
2019-08-20 12:30:23.073 16103-16103/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.ui.SignInActivity.onCreate(SignInActivity.java:113)
2019-08-20 12:30:23.073 16103-16103/com.buntingsoftware.modlist W/System.err:     at android.app.Activity.performCreate(Activity.java:7136)
2019-08-20 12:30:23.074 16103-16103/com.buntingsoftware.modlist W/System.err:     at android.app.Activity.performCreate(Activity.java:7127)
2019-08-20 12:30:23.074 16103-16103/com.buntingsoftware.modlist W/System.err:     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
2019-08-20 12:30:23.074 16103-16103/com.buntingsoftware.modlist W/System.err:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2893)
2019-08-20 12:30:23.074 16103-16103/com.buntingsoftware.modlist W/System.err:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3048)
2019-08-20 12:30:23.074 16103-16103/com.buntingsoftware.modlist W/System.err:     at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
2019-08-20 12:30:23.075 16103-16103/com.buntingsoftware.modlist W/System.err:     at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
2019-08-20 12:30:23.075 16103-16103/com.buntingsoftware.modlist W/System.err:     at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
2019-08-20 12:30:23.075 16103-16103/com.buntingsoftware.modlist W/System.err:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
2019-08-20 12:30:23.075 16103-16103/com.buntingsoftware.modlist W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:106)
2019-08-20 12:30:23.075 16103-16103/com.buntingsoftware.modlist W/System.err:     at android.os.Looper.loop(Looper.java:193)
2019-08-20 12:30:23.076 16103-16103/com.buntingsoftware.modlist W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:6669)
2019-08-20 12:30:23.076 16103-16103/com.buntingsoftware.modlist W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
2019-08-20 12:30:23.076 16103-16103/com.buntingsoftware.modlist W/System.err:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
2019-08-20 12:30:23.076 16103-16103/com.buntingsoftware.modlist W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
2019-08-20 12:30:23.076 16103-16103/com.buntingsoftware.modlist E/GoogleButton: Cannot initialize the SignInButton. Please check if IdentityManager : startUpAuth and setUpToAuthenticate are invoked
2019-08-20 12:30:23.234 16103-16132/com.buntingsoftware.modlist D/FA: Logging event (FE): screen_view(_vs), Bundle[{firebase_event_origin(_o)=auto, firebase_previous_class(_pc)=MainActivity, firebase_previous_id(_pi)=-813387870987563676, firebase_screen_class(_sc)=SignInActivity, firebase_screen_id(_si)=-813387870987563675}]
2019-08-20 12:30:23.244 16103-16103/com.buntingsoftware.modlist E/UserPoolSignInView: Cannot initialize the SignInButton. Please check if IdentityManager : startUpAuth and setUpToAuthenticate are invoked
    java.lang.IllegalArgumentException: No such provider : com.amazonaws.mobile.auth.userpools.CognitoUserPoolsSignInProvider
        at com.amazonaws.mobile.auth.core.signin.SignInManager.findProvider(SignInManager.java:273)
        at com.amazonaws.mobile.auth.core.signin.SignInManager.initializeSignInButton(SignInManager.java:261)
        at com.amazonaws.mobile.auth.userpools.UserPoolSignInView.initializeIfNecessary(UserPoolSignInView.java:124)
        at com.amazonaws.mobile.auth.userpools.UserPoolSignInView.onMeasure(UserPoolSignInView.java:248)
        at android.view.View.measure(View.java:23169)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6749)
        at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1535)
        at android.widget.LinearLayout.measureVertical(LinearLayout.java:825)
        at android.widget.LinearLayout.onMeasure(LinearLayout.java:704)
        at com.amazonaws.mobile.auth.ui.SignInView.onMeasure(SignInView.java:324)
        at android.view.View.measure(View.java:23169)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6749)
        at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
        at androidx.appcompat.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:143)
        at android.view.View.measure(View.java:23169)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6749)
        at androidx.appcompat.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:403)
        at android.view.View.measure(View.java:23169)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6749)
        at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
        at android.view.View.measure(View.java:23169)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6749)
        at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1535)
        at android.widget.LinearLayout.measureVertical(LinearLayout.java:825)
        at android.widget.LinearLayout.onMeasure(LinearLayout.java:704)
        at android.view.View.measure(View.java:23169)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6749)
        at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
        at com.android.internal.policy.DecorView.onMeasure(DecorView.java:716)
        at android.view.View.measure(View.java:23169)
        at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2718)
        at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1572)
        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1855)
        at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1460)
        at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7183)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:949)
        at android.view.Choreographer.doCallbacks(Choreographer.java:761)
        at android.view.Choreographer.doFrame(Choreographer.java:696)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:935)
        at android.os.Handler.handleCallback(Handler.java:873)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6669)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
mutablealligator commented 5 years ago

@BillBunting Sorry for the inconvenience caused. From the error logs you posted I could see the following:

java.lang.IllegalArgumentException: No such provider : com.amazonaws.mobile.auth.facebook.FacebookSignInProvider
2019-08-20 12:30:23.041 16103-16103/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.core.signin.SignInManager.findProvider(SignInManager.java:273)

This means that the SDK is trying to register FacebooKSignInProvider because of the presence of the FacebookSignIn snippet in the awsconfiguration.json. AWSMobileClient reads awsconfiguration.json for FacebookSignIn and expects the aws-android-sdk-auth-facebook dependency to be present in the build.gradle.

Can you check your build.gradle for the required dependencies?

BillBunting commented 5 years ago

@kvasukib The problem is not the dependencies as far as I can tell. Rolling back to all AWSMobileClient API versions to 2.13.1 fixes the problem. Broken in It only occasionally fails when the token is bad or after calling sign out. The app was already initialized and running successfully with the user successfully logged in. Here are the dependencies.

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.appcompat:appcompat:1.1.0-alpha05'
    implementation 'com.google.android.material:material:1.0.0'
    implementation 'androidx.vectordrawable:vectordrawable:1.0.1'
    implementation 'androidx.recyclerview:recyclerview:1.0.0'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation 'androidx.gridlayout:gridlayout:1.0.0'
    implementation 'androidx.browser:browser:1.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'androidx.multidex:multidex:2.0.1'

    implementation 'com.amazonaws:aws-android-sdk-core:2.15.0'
    implementation 'com.amazonaws:aws-android-sdk-auth-core:2.15.0@aar'

    implementation 'com.amazonaws:aws-android-sdk-cognitoauth:2.15.0@aar'

    implementation 'com.amazonaws:aws-android-sdk-pinpoint:2.15.0'
    implementation 'com.amazonaws:aws-android-sdk-ddb:2.15.0'
    implementation 'com.amazonaws:aws-android-sdk-ddb-mapper:2.15.0'
    implementation('com.amazonaws:aws-android-sdk-mobile-client:2.15.0@aar') { transitive = true }

    implementation('com.amazonaws:aws-android-sdk-auth-userpools:2.15.0@aar') { transitive = true }
    implementation('com.amazonaws:aws-android-sdk-auth-facebook:2.15.0@aar') { transitive = true }
    implementation('com.amazonaws:aws-android-sdk-auth-google:2.15.0@aar') { transitive = true }

    implementation 'androidx.appcompat:appcompat:1.1.0-alpha05'
    implementation('com.amazonaws:aws-android-sdk-auth-ui:2.15.0@aar') { transitive = true }

    implementation('com.amazonaws:aws-android-sdk-apigateway-core:2.15.0') { transitive = true }
    implementation('com.amazonaws:aws-android-sdk-cognitoidentityprovider:2.15.0') {
        transitive = true
    }

    // Glide (annotaitons 28 required for AndroidX )
    implementation 'com.github.bumptech.glide:glide:4.9.0'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
    annotationProcessor 'androidx.annotation:annotation:1.1.0-rc01'

    implementation 'com.android.volley:volley:1.1.1'
    implementation 'com.robinhood.ticker:ticker:2.0.1'
    implementation 'com.github.delight-im:Android-AdvancedWebView:v3.2.0'
    implementation 'com.github.marcoscgdev:Licenser:1.0.5'
    implementation 'com.ramotion.paperonboarding:paper-onboarding:1.1.3'
    implementation 'org.jsoup:jsoup:1.11.3'
    implementation("com.squareup.moshi:moshi:1.8.0")
    implementation 'de.hdodenhof:circleimageview:3.0.0'

    // Added per Pinpoint Push Notifications documentation:
    // https://docs.aws.amazon.com/aws-mobile/latest/developerguide/add-aws-mobile-push-notifications.html
    implementation 'com.google.android.gms:play-services-auth:16.0+'
    implementation 'com.google.firebase:firebase-core:16.0+'
    implementation 'com.google.firebase:firebase-messaging:17.+'

}
BillBunting commented 5 years ago

@kvasukib I confirmed the bug was introduced in 2.13.4. I can reproduce the bug by signing out of the app, then the sign-in screen will appear and buttons can not be pushed starting in 2.13.4. I works in 2.13.1, 2.13.2, and 2.13.3. So, a change was introduced in 2.13.4 somewhere causing this bug which remains in 2.15.0 to date.

Here is the use case error logs after signing out using 2.13.4.

I suspect something is deleting the configuration (i.e. setting it to null)

Note, the symptom appears to be that the config become invalid which should never be the case while the app remains running. After terminating the app and restarting it, the user can sign-in. Likewise, however, if the token become invalid, the user is never able to sign-in again as in the previous comment error logs.

2019-08-20 20:48:25.787 20200-20286/com.buntingsoftware.modlist D/SignInUI: Presenting the SignIn UI.
2019-08-20 20:48:25.817 20200-20200/com.buntingsoftware.modlist D/ViewRootImpl@32d9097[MainActivity]: MSG_WINDOW_FOCUS_CHANGED 0
2019-08-20 20:48:25.830 20200-20200/com.buntingsoftware.modlist V/FragmentManager: movefrom RESUMED: SupportRequestManagerFragment{22d7eaa (bc64e927-4972-4cca-b7a1-37b48cb2d50e) com.bumptech.glide.manager}{parent=null}
2019-08-20 20:48:25.830 20200-20218/com.buntingsoftware.modlist V/FA: Recording user engagement, ms: 24101
2019-08-20 20:48:25.830 20200-20200/com.buntingsoftware.modlist V/FragmentManager: movefrom RESUMED: MoreMenuItemFragment{598f923 (554e593b-2b2a-4495-9a92-00fed2d805bd) id=0x7f0a00bf}
2019-08-20 20:48:25.834 20200-20218/com.buntingsoftware.modlist V/FA: Connecting to remote service
2019-08-20 20:48:25.844 20200-20218/com.buntingsoftware.modlist V/FA: Activity paused, time: 559348086
2019-08-20 20:48:25.847 20200-20200/com.buntingsoftware.modlist V/FA: onActivityCreated
2019-08-20 20:48:25.859 20200-20200/com.buntingsoftware.modlist D/TextView: setTypeface with style : 0
2019-08-20 20:48:25.860 20200-20200/com.buntingsoftware.modlist D/TextView: setTypeface with style : 0
2019-08-20 20:48:25.861 20200-20218/com.buntingsoftware.modlist D/FA: Logging event (FE): user_engagement(_e), Bundle[{firebase_event_origin(_o)=auto, engagement_time_msec(_et)=24101, firebase_screen_class(_sc)=MainActivity, firebase_screen_id(_si)=-8838803122389461494}]
2019-08-20 20:48:25.865 20200-20200/com.buntingsoftware.modlist D/SignInView: Using defaults: backgroundColor = -12303292; logoResId = 2131230863
2019-08-20 20:48:25.865 20200-20200/com.buntingsoftware.modlist D/SignInView: Background Color : -8411204
2019-08-20 20:48:25.865 20200-20200/com.buntingsoftware.modlist D/SignInView: Logo : 2131230884
2019-08-20 20:48:25.868 20200-20200/com.buntingsoftware.modlist D/SignInView: Trying to create an instance of UserPoolSignInView
2019-08-20 20:48:25.879 20200-20218/com.buntingsoftware.modlist V/FA: Connection attempt already in progress
2019-08-20 20:48:25.885 20200-20200/com.buntingsoftware.modlist D/TextView: setTypeface with style : 0
2019-08-20 20:48:25.888 20200-20200/com.buntingsoftware.modlist W/System.err: java.lang.IllegalArgumentException: No such provider : com.amazonaws.mobile.auth.facebook.FacebookSignInProvider
2019-08-20 20:48:25.888 20200-20200/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.core.signin.SignInManager.findProvider(SignInManager.java:273)
2019-08-20 20:48:25.888 20200-20200/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.core.signin.SignInManager.initializeSignInButton(SignInManager.java:261)
2019-08-20 20:48:25.888 20200-20200/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.facebook.FacebookButton.<init>(FacebookButton.java:108)
2019-08-20 20:48:25.888 20200-20200/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.facebook.FacebookButton.<init>(FacebookButton.java:76)
2019-08-20 20:48:25.888 20200-20200/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.facebook.FacebookButton.<init>(FacebookButton.java:66)
2019-08-20 20:48:25.888 20200-20200/com.buntingsoftware.modlist W/System.err:     at java.lang.reflect.Constructor.newInstance0(Native Method)
2019-08-20 20:48:25.888 20200-20200/com.buntingsoftware.modlist W/System.err:     at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
2019-08-20 20:48:25.888 20200-20200/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.ui.SignInView.createDependencyObject(SignInView.java:421)
2019-08-20 20:48:25.888 20200-20200/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.ui.SignInView.addSignInButtonsToView(SignInView.java:502)
2019-08-20 20:48:25.889 20200-20200/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.ui.SignInView.setUpSignInButtons(SignInView.java:282)
2019-08-20 20:48:25.889 20200-20200/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.ui.SignInView.<init>(SignInView.java:317)
2019-08-20 20:48:25.889 20200-20200/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.ui.SignInView.<init>(SignInView.java:159)
2019-08-20 20:48:25.889 20200-20200/com.buntingsoftware.modlist W/System.err:     at java.lang.reflect.Constructor.newInstance0(Native Method)
2019-08-20 20:48:25.889 20200-20200/com.buntingsoftware.modlist W/System.err:     at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
2019-08-20 20:48:25.889 20200-20200/com.buntingsoftware.modlist W/System.err:     at android.view.LayoutInflater.createView(LayoutInflater.java:652)
2019-08-20 20:48:25.889 20200-20200/com.buntingsoftware.modlist W/System.err:     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:794)
2019-08-20 20:48:25.889 20200-20200/com.buntingsoftware.modlist W/System.err:     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:734)
2019-08-20 20:48:25.889 20200-20200/com.buntingsoftware.modlist W/System.err:     at android.view.LayoutInflater.inflate(LayoutInflater.java:496)
2019-08-20 20:48:25.889 20200-20200/com.buntingsoftware.modlist W/System.err:     at android.view.LayoutInflater.inflate(LayoutInflater.java:427)
2019-08-20 20:48:25.889 20200-20200/com.buntingsoftware.modlist W/System.err:     at android.view.LayoutInflater.inflate(LayoutInflater.java:378)
2019-08-20 20:48:25.889 20200-20200/com.buntingsoftware.modlist W/System.err:     at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:532)
2019-08-20 20:48:25.889 20200-20200/com.buntingsoftware.modlist W/System.err:     at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:161)
2019-08-20 20:48:25.889 20200-20200/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.ui.SignInActivity.onCreate(SignInActivity.java:113)
2019-08-20 20:48:25.889 20200-20200/com.buntingsoftware.modlist W/System.err:     at android.app.Activity.performCreate(Activity.java:6933)
2019-08-20 20:48:25.889 20200-20200/com.buntingsoftware.modlist W/System.err:     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1126)
2019-08-20 20:48:25.889 20200-20200/com.buntingsoftware.modlist W/System.err:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2914)
2019-08-20 20:48:25.889 20200-20200/com.buntingsoftware.modlist W/System.err:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3022)
2019-08-20 20:48:25.889 20200-20200/com.buntingsoftware.modlist W/System.err:     at android.app.ActivityThread.-wrap14(ActivityThread.java)
2019-08-20 20:48:25.889 20200-20200/com.buntingsoftware.modlist W/System.err:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1657)
2019-08-20 20:48:25.889 20200-20200/com.buntingsoftware.modlist W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:102)
2019-08-20 20:48:25.889 20200-20200/com.buntingsoftware.modlist W/System.err:     at android.os.Looper.loop(Looper.java:154)
2019-08-20 20:48:25.889 20200-20200/com.buntingsoftware.modlist W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:6732)
2019-08-20 20:48:25.889 20200-20200/com.buntingsoftware.modlist W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
2019-08-20 20:48:25.889 20200-20200/com.buntingsoftware.modlist W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
2019-08-20 20:48:25.889 20200-20200/com.buntingsoftware.modlist W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
2019-08-20 20:48:25.889 20200-20200/com.buntingsoftware.modlist E/FacebookButton: Cannot initialize the SignInButton. Please check if IdentityManager :  startUpAuth and setUpToAuthenticate are invoked
2019-08-20 20:48:25.892 20200-20200/com.buntingsoftware.modlist W/System.err: java.lang.IllegalArgumentException: No such provider : com.amazonaws.mobile.auth.google.GoogleSignInProvider
2019-08-20 20:48:25.892 20200-20200/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.core.signin.SignInManager.findProvider(SignInManager.java:273)
2019-08-20 20:48:25.892 20200-20200/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.core.signin.SignInManager.initializeSignInButton(SignInManager.java:261)
2019-08-20 20:48:25.892 20200-20200/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.google.GoogleButton.<init>(GoogleButton.java:108)
2019-08-20 20:48:25.892 20200-20200/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.google.GoogleButton.<init>(GoogleButton.java:77)
2019-08-20 20:48:25.892 20200-20200/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.google.GoogleButton.<init>(GoogleButton.java:67)
2019-08-20 20:48:25.892 20200-20200/com.buntingsoftware.modlist W/System.err:     at java.lang.reflect.Constructor.newInstance0(Native Method)
2019-08-20 20:48:25.892 20200-20200/com.buntingsoftware.modlist W/System.err:     at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
2019-08-20 20:48:25.892 20200-20200/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.ui.SignInView.createDependencyObject(SignInView.java:421)
2019-08-20 20:48:25.892 20200-20200/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.ui.SignInView.addSignInButtonsToView(SignInView.java:502)
2019-08-20 20:48:25.892 20200-20200/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.ui.SignInView.setUpSignInButtons(SignInView.java:282)
2019-08-20 20:48:25.892 20200-20200/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.ui.SignInView.<init>(SignInView.java:317)
2019-08-20 20:48:25.892 20200-20200/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.ui.SignInView.<init>(SignInView.java:159)
2019-08-20 20:48:25.892 20200-20200/com.buntingsoftware.modlist W/System.err:     at java.lang.reflect.Constructor.newInstance0(Native Method)
2019-08-20 20:48:25.892 20200-20200/com.buntingsoftware.modlist W/System.err:     at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
2019-08-20 20:48:25.892 20200-20200/com.buntingsoftware.modlist W/System.err:     at android.view.LayoutInflater.createView(LayoutInflater.java:652)
2019-08-20 20:48:25.893 20200-20200/com.buntingsoftware.modlist W/System.err:     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:794)
2019-08-20 20:48:25.893 20200-20200/com.buntingsoftware.modlist W/System.err:     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:734)
2019-08-20 20:48:25.893 20200-20200/com.buntingsoftware.modlist W/System.err:     at android.view.LayoutInflater.inflate(LayoutInflater.java:496)
2019-08-20 20:48:25.893 20200-20200/com.buntingsoftware.modlist W/System.err:     at android.view.LayoutInflater.inflate(LayoutInflater.java:427)
2019-08-20 20:48:25.893 20200-20200/com.buntingsoftware.modlist W/System.err:     at android.view.LayoutInflater.inflate(LayoutInflater.java:378)
2019-08-20 20:48:25.893 20200-20200/com.buntingsoftware.modlist W/System.err:     at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:532)
2019-08-20 20:48:25.893 20200-20200/com.buntingsoftware.modlist W/System.err:     at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:161)
2019-08-20 20:48:25.893 20200-20200/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.ui.SignInActivity.onCreate(SignInActivity.java:113)
2019-08-20 20:48:25.893 20200-20200/com.buntingsoftware.modlist W/System.err:     at android.app.Activity.performCreate(Activity.java:6933)
2019-08-20 20:48:25.893 20200-20200/com.buntingsoftware.modlist W/System.err:     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1126)
2019-08-20 20:48:25.893 20200-20200/com.buntingsoftware.modlist W/System.err:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2914)
2019-08-20 20:48:25.893 20200-20200/com.buntingsoftware.modlist W/System.err:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3022)
2019-08-20 20:48:25.893 20200-20200/com.buntingsoftware.modlist W/System.err:     at android.app.ActivityThread.-wrap14(ActivityThread.java)
2019-08-20 20:48:25.893 20200-20200/com.buntingsoftware.modlist W/System.err:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1657)
2019-08-20 20:48:25.893 20200-20200/com.buntingsoftware.modlist W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:102)
2019-08-20 20:48:25.893 20200-20200/com.buntingsoftware.modlist W/System.err:     at android.os.Looper.loop(Looper.java:154)
2019-08-20 20:48:25.893 20200-20200/com.buntingsoftware.modlist W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:6732)
2019-08-20 20:48:25.893 20200-20200/com.buntingsoftware.modlist W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
2019-08-20 20:48:25.893 20200-20200/com.buntingsoftware.modlist W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
2019-08-20 20:48:25.893 20200-20200/com.buntingsoftware.modlist W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
2019-08-20 20:48:25.893 20200-20200/com.buntingsoftware.modlist E/GoogleButton: Cannot initialize the SignInButton. Please check if IdentityManager : startUpAuth and setUpToAuthenticate are invoked
2019-08-20 20:48:25.899 20200-20200/com.buntingsoftware.modlist D/ViewRootImpl@37a4494[SignInActivity]: ThreadedRenderer.create() translucent=false
2019-08-20 20:48:25.901 20200-20200/com.buntingsoftware.modlist D/InputTransport: Input channel constructed: fd=113
2019-08-20 20:48:25.902 20200-20200/com.buntingsoftware.modlist D/ViewRootImpl@37a4494[SignInActivity]: setView = DecorView@a6c7b3d[SignInActivity] touchMode=true
2019-08-20 20:48:25.912 20200-20200/com.buntingsoftware.modlist D/ViewRootImpl@37a4494[SignInActivity]: dispatchAttachedToWindow
2019-08-20 20:48:25.913 20200-20218/com.buntingsoftware.modlist D/FA: Logging event (FE): screen_view(_vs), Bundle[{firebase_event_origin(_o)=auto, firebase_previous_class(_pc)=MainActivity, firebase_previous_id(_pi)=-8838803122389461494, firebase_screen_class(_sc)=SignInActivity, firebase_screen_id(_si)=-8838803122389461493}]
2019-08-20 20:48:25.924 20200-20200/com.buntingsoftware.modlist E/UserPoolSignInView: Cannot initialize the SignInButton. Please check if IdentityManager : startUpAuth and setUpToAuthenticate are invoked
    java.lang.IllegalArgumentException: No such provider : com.amazonaws.mobile.auth.userpools.CognitoUserPoolsSignInProvider
        at com.amazonaws.mobile.auth.core.signin.SignInManager.findProvider(SignInManager.java:273)
        at com.amazonaws.mobile.auth.core.signin.SignInManager.initializeSignInButton(SignInManager.java:261)
        at com.amazonaws.mobile.auth.userpools.UserPoolSignInView.initializeIfNecessary(UserPoolSignInView.java:124)
        at com.amazonaws.mobile.auth.userpools.UserPoolSignInView.onMeasure(UserPoolSignInView.java:248)
        at android.view.View.measure(View.java:21035)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6459)
        at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1464)
        at android.widget.LinearLayout.measureVertical(LinearLayout.java:758)
        at android.widget.LinearLayout.onMeasure(LinearLayout.java:640)
        at com.amazonaws.mobile.auth.ui.SignInView.onMeasure(SignInView.java:324)
        at android.view.View.measure(View.java:21035)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6459)
        at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
        at androidx.appcompat.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:143)
        at android.view.View.measure(View.java:21035)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6459)
        at androidx.appcompat.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:403)
        at android.view.View.measure(View.java:21035)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6459)
        at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
        at android.view.View.measure(View.java:21035)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6459)
        at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1464)
        at android.widget.LinearLayout.measureVertical(LinearLayout.java:758)
        at android.widget.LinearLayout.onMeasure(LinearLayout.java:640)
        at android.view.View.measure(View.java:21035)
        at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6459)
        at android.widget.FrameLayout.onMeasure(FrameLayout.java:185)
        at com.android.internal.policy.DecorView.onMeasure(DecorView.java:851)
        at android.view.View.measure(View.java:21035)
        at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2571)
        at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1631)
        at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1882)
        at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1511)
        at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7084)
        at android.view.Choreographer$CallbackRecord.run(Choreographer.java:927)
        at android.view.Choreographer.doCallbacks(Choreographer.java:702)
        at android.view.Choreographer.doFrame(Choreographer.java:638)
        at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:913)
        at android.os.Handler.handleCallback(Handler.java:751)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:154)
        at android.app.ActivityThread.main(ActivityThread.java:6732)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
BillBunting commented 5 years ago

@kvasukib Any more thoughts on this? I am unable to upgrade past 2.13.3 due to this issue.

BillBunting commented 5 years ago

@kvasukib Confirmed that this issue happens when the token expires after 1 hour. After the exception:

2019-08-20 12:30:22.473 16103-16166/com.buntingsoftware.modlist W/AWSMobileClient: Failed to federate the tokens.
    com.amazonaws.services.cognitoidentity.model.NotAuthorizedException: Invalid login token. Couldn't verify signed token. (Service: AmazonCognitoIdentity; Status Code: 400; Error Code: NotAuthorizedException; Request ID: cf3c15d2-c367-11e9-a739-49e777685918)
        at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:730)

The SignIn UI attempts to create the sign-in screens but the AWS configuration previously loaded from the json file is not found or is null, etc. Thus, the No such provider exceptions appear.

BillBunting commented 5 years ago

Any update on this?

BillBunting commented 5 years ago

Still a problem for me after upgrading to 2.16.0. After sign-out, especially after an hour, the buttons on the provided sign-in UI do not do anything.

mutablealligator commented 5 years ago

@BillBunting I am looking at the changes introduced in 2.13.4 version of the SDK: https://github.com/aws-amplify/aws-sdk-android/commit/6366298d05f71288a410446812c437df1790a7bf#diff-4c45bdc12da735f85afbec1351910e2dR2932 mainly on the change where a call to registerConfigSignInProviders is introduced as part of showSignIn API where we register the SignIn providers if they are not registered (Eg: Facebook and Google).

From what you have described so far, I am suspecting the above changes that are introduced in 2.13.4 version of the SDK among all the changes in AWSMobileClient.

Suspect in signOut:

I checked the signOut implementation and the signOut calls IdentityManager.getDefaultIdentityManager().signOut() which will clear the current IdentityProvider / SignInProvider and set the reference to null. However I do not see this to interfere with the SignInProvider being not found because a call to showSignIn will register the SignInProviders again with the IdentityManager and SignInManager.

Suspect in registerConfigSignInProviders:

If the awsConfiguration object would be null, that would be caught by this following log statement. Can you check if you have this log statement as part of your logs after calling showSignIn.

https://github.com/aws-amplify/aws-sdk-android/blob/master/aws-android-sdk-mobile-client/src/main/java/com/amazonaws/mobile/client/AWSMobileClient.java#L3144

From the code, I could see that awsConfiguration could be set to null by a call to AWSMobileClient.initialize of the legacy AWSMobileClient API. Can you check between signOut and showSignIn if you call legacy version of AWSMobileClient.initialize as in https://github.com/aws-amplify/aws-sdk-android/blob/master/aws-android-sdk-mobile-client/src/main/java/com/amazonaws/mobile/client/AWSMobileClient.java#L3187

In addition to this, can you post a code snippet where you are calling initialize, showSignIn and signOut of AWSMobileClient?

BillBunting commented 5 years ago

@kvasukib I checked what you recommended.

Please note, the problem is intermittent, like a race condition or timeout unless the token is expired (an hour has past), then it happens every time.

If the awsConfiguration object would be null, that would be caught by this following log statement. Can you check if you have this log statement as part of your logs after calling showSignIn. https://github.com/aws-amplify/aws-sdk-android/blob/master/aws-android-sdk-mobile-client/src/main/java/com/amazonaws/mobile/client/AWSMobileClient.java#L3144

This log statement does not appear.

Rather, I seem to get this error:

2019-09-23 16:10:30.110 908-908/? D/SignInView: Trying to create an instance of UserPoolSignInView
2019-09-23 16:10:30.126 908-908/? D/TextView: setTypeface with style : 0
2019-09-23 16:10:30.130 908-908/? W/System.err: java.lang.IllegalArgumentException: No such provider : com.amazonaws.mobile.auth.facebook.FacebookSignInProvider

Here is my method to initialize:

    private void initializeAWSMobileClient() {
        Log.d(TAG, "initializeAWSMobileClient() AWSMobileClient.getInstance().initialize() : calling...: appInitDone=" + appInitDone);

        if (appInitDone == true) {
            Log.d(TAG, "initializeAWSMobileClient() called when appInitDone true. Do nothing and return");
            return;
        }

        AWSMobileClient.getInstance().initialize(this, new Callback<UserStateDetails>() {

                    @Override
                    public void onResult(UserStateDetails userStateDetails) {
                        Log.d(TAG, "initializeAWSMobileClient() AWSMobileClient.getInstance().initialize() : userState: " + userStateDetails.getUserState());

                        AWSHelper.initialize(MainActivity.this);
                        registerUserStateListener();
                        appInitDone = true;

                        switch (userStateDetails.getUserState()) {
                            case SIGNED_IN:
                                Log.d(TAG, "initializeAWSMobileClient() AWSMobileClient.getInstance().initialize(): userState: logged in!");
                                initializeAndLoadData(); // When mBio was saved with instance state but appInitDone false, state listener will not be called.
                                break;
                            case SIGNED_OUT:
                                Log.d(TAG, "initializeAWSMobileClient() AWSMobileClient.getInstance().initialize(): userState: signed out!");
                                break;
                            default:
                                Log.e(TAG, "initializeAWSMobileClient() AWSMobileClient.getInstance().initialize(): userState: case default!");
                                AWSMobileClient.getInstance().signOut();
                                showSignIn();
                                break;
                        }
                    }

                    @Override
                    public void onError(Exception e) {
                        Log.e(TAG, "AWSMobileClient.getInstance().initialize() : Initialization error.", e);
                        appInitDone = false;
                    }

                }
        );
    }

My init method is called from onResume() of the MainActivity.class:

    @Override
    protected void onResume() {
        super.onResume();
        Log.d(TAG, "onResume()");
        Log.d(TAG, "onResume() with mBio: " + mBio);

        onSaveInstanceStateActive = false;

        if (mBio == null && TermsActivity.requireTerms(this)) {
            Log.d(TAG, "onResume(): started terms activity.");
            Intent intent = new Intent(this, TermsActivity.class);
            startActivity(intent);
            initializeAWSMobileClientThenSignOut();
            return;
        }

        if (mBio == null && doOnboarding()) {
            return;
        }

        if (mBio != null && appInitDone) {
            Log.d(TAG, "onResume(): mBio exists and appInitDone is true.");
        } else if (mBio == null && appInitDone) {
            Log.e(TAG, "onResume(): mBio null and appInitDone is true.");
            initializeAndLoadData();
        } else {
            Log.d(TAG, "onResume(): calling initializeAWSMobileClient()");
            initializeAWSMobileClient();
        }
    }

showSignIn and showSignOut are called from:

    private void registerUserStateListener() {

        Log.d(TAG, "registerUserStateListener() called.");

        UserStateListener listener = ((ModListApplication) getApplication()).userStateListener;

        if ( listener != null ) {
            AWSMobileClient.getInstance().removeUserStateListener(listener);
            listener = null;
        }

        listener = new UserStateListener() {
            @Override
            public void onUserStateChanged(UserStateDetails userStateDetails) {

                Log.d(TAG, "onUserStateChanged() userState() " + userStateDetails.getUserState());

                switch (userStateDetails.getUserState()){
                    case SIGNED_IN:
                        Log.i("onUserStateChanged", "SIGNED_IN: ");
                        initializeAndLoadData();
                        break;
                    case SIGNED_OUT:
                        Log.i("onUserStateChanged", "SIGNED_OUT:");
                        showSignIn();
                        break;
                    case SIGNED_OUT_USER_POOLS_TOKENS_INVALID:
                        Log.i("onUserStateChanged", "SIGNED_OUT_USER_POOLS_TOKENS_INVALID: need to login again.");
                        showSignIn();
                        break;
                    case SIGNED_OUT_FEDERATED_TOKENS_INVALID:
                        Log.i("onUserStateChanged", "SIGNED_OUT_FEDERATED_TOKENS_INVALID: need to login again.");
                        showSignIn();
                        break;
                    case GUEST:
                        Log.i("onUserStateChanged", "GUEST.");
                        showSignIn();
                        break;
                    default:
                        Log.i("onUserStateChanged", "unsupported, default.");
                        showSignIn();
                        break;
                }
            }
        };

        AWSMobileClient.getInstance().addUserStateListener(listener);
        ((ModListApplication) getApplication()).userStateListener = listener;
    }

showSignOut from the app's signOut menu is called by this method:

    private void autoModListSignOut() {
        Log.d(TAG, "autoModListSignOut() called.");
        abortTasks(); // aborts two specific tasks getting data from DynamoDB, if they are running
        mBio = null;
        appInitDone = false; // force the app to reinit 
        AWSMobileClient.getInstance().signOut(); // will trigger sign-in
    }
BillBunting commented 5 years ago

@kvasukib Unfortunately, testing shows that after an hour or sometimes after just a few minutes with a sign-out, the buttons on the sign in page do not do anything, as previously reported. The app reports the following error.

2019-09-23 22:00:28.002 8321-8396/com.buntingsoftware.modlist D/AWSMobileClient: Inspecting user state details
2019-09-23 22:00:28.004 8321-8396/com.buntingsoftware.modlist D/AWSMobileClient: waitForSignIn: userState:SIGNED_OUT
2019-09-23 22:00:28.004 8321-8396/com.buntingsoftware.modlist D/CognitoCachingCredentialsProvider: Loading credentials from SharedPreferences
2019-09-23 22:00:28.007 8321-8396/com.buntingsoftware.modlist D/CognitoCachingCredentialsProvider: No valid credentials found in SharedPreferences
2019-09-23 22:00:28.007 8321-8396/com.buntingsoftware.modlist D/CognitoCachingCredentialsProvider: Making a network call to fetch credentials.
2019-09-23 22:00:28.010 8321-8396/com.buntingsoftware.modlist I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
2019-09-23 22:00:28.010 8321-8396/com.buntingsoftware.modlist I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
2019-09-23 22:00:28.077 8321-8396/com.buntingsoftware.modlist E/CognitoCachingCredentialsProvider: Failure to get credentials
    com.amazonaws.services.cognitoidentity.model.NotAuthorizedException: Unauthenticated access is not supported for this identity pool. (Service: AmazonCognitoIdentity; Status Code: 400; Error Code: NotAuthorizedException; Request ID: 1375211b-de6f-11e9-b06e-4d07ca2af5a2)
        at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:730)

Every time the buttons are pressed, the only output is the following line for each press. All screen buttons are affected ("Sign-in". "Create New Account", "Forgot Your Password?", "Continue with Facebook" and Sign in with Google")

2019-09-23 22:03:15.637 8321-8321/com.buntingsoftware.modlist D/ViewRootImpl@5bda17a[SignInActivity]: ViewPostImeInputStage processPointer 1

This just confirms that the onClick() is not getting registered because the sign in providers are null. SignInManager.signInProviders is null.

As a workaround, I am calling AWSMobileClient.getInstance.initialize again from my sign out method invoked from the menu.

    private void autoModListSignOut() {
        Log.d(TAG, "autoModListSignOut() called.");
        abortTasks();
        mBio = null;
        appInitDone = false;
        AWSMobileClient.getInstance().signOut();
        initializeAWSMobileClient();
    }

I'll see what happens. So far, I can not reproduce the error using sign out and will wait again for tokens to expire.

Nope, this did not help either.

Error shows that the providers are missing or similar.

2019-09-23 23:57:06.048 16913-16913/com.buntingsoftware.modlist E/UserPoolSignInView: Cannot initialize the SignInButton. Please check if IdentityManager : startUpAuth and setUpToAuthenticate are invoked
    java.lang.IllegalArgumentException: No such provider : com.amazonaws.mobile.auth.userpools.CognitoUserPoolsSignInProvider
        at com.amazonaws.mobile.auth.core.signin.SignInManager.findProvider(SignInManager.java:273)
        at com.amazonaws.mobile.auth.core.signin.SignInManager.initializeSignInButton(SignInManager.java:261)
        at com.amazonaws.mobile.auth.userpools.UserPoolSignInView.initializeIfNecessary(UserPoolSignInView.java:124)
        at com.amazonaws.mobile.auth.userpools.UserPoolSignInView.onMeasure(UserPoolSignInView.java:248)
        at android.view.View.measure(View.java:21035)

Killing and restarting the app temporarily fixes the issue.

mutablealligator commented 5 years ago

@BillBunting Thank you for providing additional details.

Why do you call initializeMobileClientAndSignOut in the onResume method of your activity? My main question is why are you signing out the user every time the activity is being resumed?

2019-09-23 22:00:28.077 8321-8396/com.buntingsoftware.modlist E/CognitoCachingCredentialsProvider: Failure to get credentials
    com.amazonaws.services.cognitoidentity.model.NotAuthorizedException: Unauthenticated access is not supported for this identity pool. (Service: AmazonCognitoIdentity; Status Code: 400; Error Code: NotAuthorizedException; Request ID: 1375211b-de6f-11e9-b06e-4d07ca2af5a2)
        at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java

For this I would recommend checking if your IdentityPool has Unauthenticated access enabled. When the user is signed out, there is no valid token available with the AWSMobileClient and if you call getCredentials through AWSMobileClient, it will try to retrieve Unauthenticated credentials. Either you can enable this on the Cognito console and let your app handle unauthenticated credentials (mimics user operating in guest mode) or remove calls to getCredentials() after the user is signed out.

BillBunting commented 5 years ago

@kvasukib , thank for taking a look.

Why do you call initializeMobileClientAndSignOut in the onResume method of your activity? My main question is why are you signing out the user every time the activity is being resumed?

In onResume the user is only signed out if they have not agreed to the app's terms and conditions and they are not already signed in (bio is null if they are not signed in). If they have already agreed to terms and conditions, and the AWSMobileClient has not been initialized, it will be initialized. Otherwise, the app just continues and loads the user data.

You asked why I call AWSMobileClient.getInstance().getAWSCredentials? If I do not call it, then I found that a call to AWSMobileClient.getInstance().getIdentityId() will return null if called immediately after sign in. By calling getAWSCredentials first, it retrieves the IdentityId() which I am using in a query to get the user bio with a key containing their identityId.

Either way, I don't think this is directly related to the buttons sometimes not working on the AWS sign-in UI?

Here is the critical log section of a time when the buttons do nothing when pushed in the UI. Use case: User is already signed-in, user selects the app's sign-out menu option which then called AWSMobileClient.getInstance().signOut() followed by a call to AWSMobileClient.getInstance().initialize (I have tried with and without this extra call to initialize, followed by a call to AWSMobileClient.getInstance().showSignIn() Note that exception java.lang.IllegalArgumentException: No such provider : com.amazonaws.mobile.auth.facebook.FacebookSignInProvider

2019-10-01 17:29:21.914 9829-9960/com.buntingsoftware.modlist D/MainActivity: showSignIn()
2019-10-01 17:29:21.921 9829-9961/com.buntingsoftware.modlist D/KeyProvider23: AndroidKeyStore contains keyAlias com.amazonaws.mobile.client.aesKeyStoreAlias
2019-10-01 17:29:21.921 9829-9961/com.buntingsoftware.modlist D/KeyProvider23: Loading the encryption key from Android KeyStore.
2019-10-01 17:29:21.923 9829-9961/com.buntingsoftware.modlist D/KeyProvider23: AndroidKeyStore contains keyAlias com.amazonaws.mobile.client.aesKeyStoreAlias
2019-10-01 17:29:21.923 9829-9961/com.buntingsoftware.modlist D/KeyProvider23: Loading the encryption key from Android KeyStore.
2019-10-01 17:29:21.925 9829-9961/com.buntingsoftware.modlist D/KeyProvider23: AndroidKeyStore contains keyAlias com.amazonaws.mobile.client.aesKeyStoreAlias
2019-10-01 17:29:21.925 9829-9961/com.buntingsoftware.modlist D/KeyProvider23: Loading the encryption key from Android KeyStore.
2019-10-01 17:29:21.928 9829-9961/com.buntingsoftware.modlist D/KeyProvider23: AndroidKeyStore contains keyAlias com.amazonaws.mobile.client.aesKeyStoreAlias
2019-10-01 17:29:21.928 9829-9961/com.buntingsoftware.modlist D/KeyProvider23: Loading the encryption key from Android KeyStore.
2019-10-01 17:29:21.929 9829-9961/com.buntingsoftware.modlist D/AWSMobileClient: Inspecting user state details
2019-10-01 17:29:21.929 9829-9961/com.buntingsoftware.modlist D/MainActivity: initializeAWSMobileClient() AWSMobileClient.getInstance().initialize() : userState: SIGNED_OUT
2019-10-01 17:29:21.930 9829-9961/com.buntingsoftware.modlist D/AWSHelper: initialize
2019-10-01 17:29:21.930 9829-9961/com.buntingsoftware.modlist D/MainActivity: registerUserStateListener() called.
2019-10-01 17:29:21.930 9829-9961/com.buntingsoftware.modlist D/MainActivity: initializeAWSMobileClient() AWSMobileClient.getInstance().initialize(): userState: signed out!
2019-10-01 17:29:21.931 9829-9962/com.buntingsoftware.modlist D/KeyProvider23: AndroidKeyStore contains keyAlias com.amazonaws.mobile.client.aesKeyStoreAlias
2019-10-01 17:29:21.931 9829-9962/com.buntingsoftware.modlist D/KeyProvider23: Loading the encryption key from Android KeyStore.
2019-10-01 17:29:21.933 9829-9962/com.buntingsoftware.modlist D/KeyProvider23: AndroidKeyStore contains keyAlias com.amazonaws.mobile.client.aesKeyStoreAlias
2019-10-01 17:29:21.933 9829-9962/com.buntingsoftware.modlist D/KeyProvider23: Loading the encryption key from Android KeyStore.
2019-10-01 17:29:21.936 9829-9962/com.buntingsoftware.modlist D/KeyProvider23: AndroidKeyStore contains keyAlias com.amazonaws.mobile.client.aesKeyStoreAlias
2019-10-01 17:29:21.936 9829-9962/com.buntingsoftware.modlist D/KeyProvider23: Loading the encryption key from Android KeyStore.
2019-10-01 17:29:21.938 9829-9962/com.buntingsoftware.modlist D/KeyProvider23: AndroidKeyStore contains keyAlias com.amazonaws.mobile.client.aesKeyStoreAlias
2019-10-01 17:29:21.938 9829-9962/com.buntingsoftware.modlist D/KeyProvider23: Loading the encryption key from Android KeyStore.
2019-10-01 17:29:21.939 9829-9962/com.buntingsoftware.modlist D/AWSMobileClient: Inspecting user state details
2019-10-01 17:29:21.940 9829-9962/com.buntingsoftware.modlist D/AWSMobileClient: Using the SignInProviderConfig from `awsconfiguration.json`.
2019-10-01 17:29:21.942 9829-9962/com.buntingsoftware.modlist D/AWSMobileClient: Retrieving the client instance for class: class com.amazonaws.mobile.auth.ui.SignInUI
2019-10-01 17:29:21.943 9829-9962/com.buntingsoftware.modlist D/SignInUI: Initializing SignInUI.
2019-10-01 17:29:21.944 9829-9962/com.buntingsoftware.modlist D/AWSMobileClient: Created the new client: com.amazonaws.mobile.auth.ui.SignInUI@722cb21
2019-10-01 17:29:21.948 9829-9962/com.buntingsoftware.modlist D/SignInUI: Initiating the SignIn flow.
2019-10-01 17:29:21.948 9829-9962/com.buntingsoftware.modlist D/SignInUI: User is not signed-in. Presenting the SignInUI.
2019-10-01 17:29:21.949 9829-9962/com.buntingsoftware.modlist D/SignInUI: Presenting the SignIn UI.
2019-10-01 17:29:21.964 9829-9829/com.buntingsoftware.modlist V/FragmentManager: movefrom RESUMED: SupportRequestManagerFragment{838cf37 (b34fcd4e-6590-4591-b012-e01456988354) com.bumptech.glide.manager}{parent=null}
2019-10-01 17:29:21.964 9829-9829/com.buntingsoftware.modlist V/FragmentManager: movefrom RESUMED: MoreMenuItemFragment{658c174 (e13680b5-9e2d-4a0d-8184-df974ba678de) id=0x7f0a00c2}
2019-10-01 17:29:21.965 9829-9869/com.buntingsoftware.modlist V/FA: Recording user engagement, ms: 28315
2019-10-01 17:29:21.968 9829-9869/com.buntingsoftware.modlist V/FA: Connecting to remote service
2019-10-01 17:29:21.975 9829-9829/com.buntingsoftware.modlist W/ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@684e93d
2019-10-01 17:29:21.983 9829-9869/com.buntingsoftware.modlist V/FA: Activity paused, time: 3469476
2019-10-01 17:29:21.986 9829-9829/com.buntingsoftware.modlist V/FA: onActivityCreated
2019-10-01 17:29:21.991 9829-9869/com.buntingsoftware.modlist D/FA: Logging event (FE): user_engagement(_e), Bundle[{firebase_event_origin(_o)=auto, engagement_time_msec(_et)=28315, firebase_screen_class(_sc)=MainActivity, firebase_screen_id(_si)=-6928585676206853384}]
2019-10-01 17:29:22.018 9829-9829/com.buntingsoftware.modlist D/SignInView: Using defaults: backgroundColor = -12303292; logoResId = 2131230863
2019-10-01 17:29:22.018 9829-9829/com.buntingsoftware.modlist D/SignInView: Background Color : -8411204
2019-10-01 17:29:22.018 9829-9829/com.buntingsoftware.modlist D/SignInView: Logo : 2131230884
2019-10-01 17:29:22.023 9829-9829/com.buntingsoftware.modlist D/SignInView: Trying to create an instance of UserPoolSignInView
2019-10-01 17:29:22.026 9829-9869/com.buntingsoftware.modlist V/FA: Connection attempt already in progress
2019-10-01 17:29:22.045 9829-9829/com.buntingsoftware.modlist W/System.err: java.lang.IllegalArgumentException: No such provider : com.amazonaws.mobile.auth.facebook.FacebookSignInProvider
BillBunting commented 5 years ago

Still struggling with and unable to upgrade from 2.13.3. Works in 2.13.3, but signIn, Facebook, and Google buttons do not work in versions up to and including 2.16.1.

BillBunting commented 4 years ago

Still having the issue in 2.16.3. Users report the Google (or Facebook) sign-in buttons do not do anything. The happens when users have not used the app in a while. Had to revert back to 2.13.3 again.

BillBunting commented 4 years ago

Verified this remains a problem in 2.16.7. After sign out of after token expiration, show sign screen displays but buttons are in-active.

TrekSoft commented 4 years ago

Hey @BillBunting - sorry this ticket just went silent on you here. Did you end up finding a workaround or is this still an issue? Also, just so you know, the team is currently in the process of getting a new native sign in UI experience developed which will work with Amplify Auth.

BillBunting commented 4 years ago

@TrekSoft Yes, this remains a problem. As a workaround, I have left com.amazonaws:aws-android-sdk-mobile-client at 2.13.3 and upgraded everything else and the problem does not occur. I was able to upgrade all to 2.17.1 and tested just now. After sign-out, the buttons are not active (can not be clicked). Reverting only com.amazonaws:aws-android-sdk-mobile-client to 2.13.3 fixes the issue. My app was built from initially from MobileHub and uses Identity Pools for federated sign-in.

TrekSoft commented 4 years ago

Alright, gotcha - hopefully the new native sign in solution will be done soon and be a good permanent solution. If not, and we get more traction on this ticket, we'll prioritize fixing this in the new version of the mobile-client library accordingly.

BillBunting commented 3 years ago

Confirming this is still a bug in 2.22.2. Last working version remains 2.13.3.

Upon sign out, exceptions are thrown attempting to display the sign-in UI, buttons appear but do not accept input touches.

2021-02-22 12:22:29.758 9737-9737/com.buntingsoftware.modlist D/IdentityManager: Signing out...

2021-02-22 12:22:29.850 9737-10447/com.buntingsoftware.modlist D/MainActivity: onUserStateChanged() userState() SIGNED_OUT
2021-02-22 12:22:29.850 9737-9737/com.buntingsoftware.modlist D/MainActivity: initializeAWSMobileClient() AWSMobileClient.getInstance().initialize() : calling...: appInitDone=true
2021-02-22 12:22:29.853 9737-10447/com.buntingsoftware.modlist I/onUserStateChanged: SIGNED_OUT:
2021-02-22 12:22:29.853 9737-9737/com.buntingsoftware.modlist D/MainActivity: initializeAWSMobileClient() called when appInitDone true. Do nothing and return
2021-02-22 12:22:29.853 9737-10447/com.buntingsoftware.modlist D/MainActivity: showSignIn() ENTER

2021-02-22 12:22:29.934 9737-10448/com.buntingsoftware.modlist D/SignInUI: Initializing SignInUI.
2021-02-22 12:22:29.934 9737-10448/com.buntingsoftware.modlist D/AWSMobileClient: Created the new client: com.amazonaws.mobile.auth.ui.SignInUI@a0697da
2021-02-22 12:22:29.939 9737-10448/com.buntingsoftware.modlist D/SignInUI: Initiating the SignIn flow.
2021-02-22 12:22:29.939 9737-10448/com.buntingsoftware.modlist D/SignInUI: User is not signed-in. Presenting the SignInUI.
2021-02-22 12:22:29.940 9737-10448/com.buntingsoftware.modlist D/SignInUI: Presenting the SignIn UI.

2021-02-22 12:22:30.527 9737-9737/com.buntingsoftware.modlist D/SignInView: Trying to create an instance of UserPoolSignInView

2021-02-22 12:22:30.727 9737-9737/com.buntingsoftware.modlist W/System.err: java.lang.IllegalArgumentException: No such provider : com.amazonaws.mobile.auth.facebook.FacebookSignInProvider
2021-02-22 12:22:30.758 9737-9737/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.core.signin.SignInManager.findProvider(SignInManager.java:273)
2021-02-22 12:22:30.758 9737-9737/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.core.signin.SignInManager.initializeSignInButton(SignInManager.java:261)
2021-02-22 12:22:30.758 9737-9737/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.facebook.FacebookButton.<init>(FacebookButton.java:108)
2021-02-22 12:22:30.758 9737-9737/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.facebook.FacebookButton.<init>(FacebookButton.java:76)
2021-02-22 12:22:30.758 9737-9737/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.facebook.FacebookButton.<init>(FacebookButton.java:66)
2021-02-22 12:22:30.758 9737-9737/com.buntingsoftware.modlist W/System.err:     at java.lang.reflect.Constructor.newInstance0(Native Method)
2021-02-22 12:22:30.758 9737-9737/com.buntingsoftware.modlist W/System.err:     at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
2021-02-22 12:22:30.758 9737-9737/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.ui.SignInView.createDependencyObject(SignInView.java:421)
2021-02-22 12:22:30.758 9737-9737/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.ui.SignInView.addSignInButtonsToView(SignInView.java:502)
2021-02-22 12:22:30.758 9737-9737/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.ui.SignInView.setUpSignInButtons(SignInView.java:282)
2021-02-22 12:22:30.758 9737-9737/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.ui.SignInView.<init>(SignInView.java:317)
2021-02-22 12:22:30.758 9737-9737/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.ui.SignInView.<init>(SignInView.java:159)

2021-02-22 12:22:30.759 9737-9737/com.buntingsoftware.modlist E/FacebookButton: Cannot initialize the SignInButton. Please check if IdentityManager :  startUpAuth and setUpToAuthenticate are invoked

2021-02-22 12:22:30.764 9737-9737/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.core.signin.SignInManager.findProvider(SignInManager.java:273)
2021-02-22 12:22:30.764 9737-9737/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.core.signin.SignInManager.initializeSignInButton(SignInManager.java:261)
2021-02-22 12:22:30.764 9737-9737/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.google.GoogleButton.<init>(GoogleButton.java:108)
2021-02-22 12:22:30.764 9737-9737/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.google.GoogleButton.<init>(GoogleButton.java:77)
2021-02-22 12:22:30.764 9737-9737/com.buntingsoftware.modlist W/System.err:     at com.amazonaws.mobile.auth.google.GoogleButton.<init>(GoogleButton.java:67)
2021-02-22 12:22:30.764 9737-9737/com.buntingsoftware.modlist W/System.err:     at java.lang.reflect.Constructor.newInstance0(Native Method)
2021-02-22 12:22:30.764 9737-9737/com.buntingsoftware.modlist W/System.err:     at java.lang.reflect.Constructor.newInstance(Constructor.java:430)

2021-02-22 12:22:30.765 9737-9737/com.buntingsoftware.modlist E/GoogleButton: Cannot initialize the SignInButton. Please check if IdentityManager : startUpAuth and setUpToAuthenticate are invoked

2021-02-22 12:22:30.926 9737-9737/com.buntingsoftware.modlist E/UserPoolSignInView: Cannot initialize the SignInButton. Please check if IdentityManager : startUpAuth and setUpToAuthenticate are invoked
    java.lang.IllegalArgumentException: No such provider : com.amazonaws.mobile.auth.userpools.CognitoUserPoolsSignInProvider
        at com.amazonaws.mobile.auth.core.signin.SignInManager.findProvider(SignInManager.java:273)
        at com.amazonaws.mobile.auth.core.signin.SignInManager.initializeSignInButton(SignInManager.java:261)
        at com.amazonaws.mobile.auth.userpools.UserPoolSignInView.initializeIfNecessary(UserPoolSignInView.java:123)
        at com.amazonaws.mobile.auth.userpools.UserPoolSignInView.onMeasure(UserPoolSignInView.java:247)
        at android.view.View.measure(View.java:21035)
BillBunting commented 3 years ago

@TrekSoft and @kvasukib I spent a few more hours debugging and looking at the diff between 2.13.3 and 2.13.4. I re-confirmed the bug was introduced in 2.13.4 and still exists in 2.22.2.

The comparison: https://github.com/aws-amplify/aws-sdk-android/compare/release_v2.13.3...release_v2.13.4

Changes related to moving and modifying registerConfigSignInProviders(); are suspect. The AWSConfiguration is not set when called in all use cases.

Confirmed. By moving the call to registerConfigSignInProviders(); up to _initialize in AWSMobleClient.java resoles the problem when MobileClient "Failed to federate the tokens. Token expired:". MobileClient return SIGN_IN state then immediately returns SIGNED_OUT_FEDERATED_TOKENS_INVALID to the user state listener.

I'll create a pull request.

richardmcclellan commented 3 years ago

Closing, since this was fixed by https://github.com/aws-amplify/aws-sdk-android/pull/2386