Aws-sdk-android: AWSMobileClient federated sign in facebook always return onResult even though give wrong token

Created on 18 Mar 2019  路  4Comments  路  Source: aws-amplify/aws-sdk-android

Describe the bug
Even though give wrong token, but the callback of federatedSignIn method using facebook token always return onResult with UserState is SIGNED_IN. After that, the log print stack trace with invalid token.

To Reproduce

AWSMobileClient.getInstance().federatedSignIn(IdentityProvider.FACEBOOK.toString(),
                        "123454634",
                        new Callback<UserStateDetails>() {
                            @Override
                            public void onResult(UserStateDetails result) {

                                Log.d(TAG, "onResult: " + result.getUserState());
                            }

                            @Override
                            public void onError(Exception e) {
                                e.printStackTrace();
                                Log.d(TAG, "onError: " + e);
                            }
                        });

Which AWS service(s) are affected?
AWSMobileClient

Expected behavior
Return SIGNED_OUT_FEDERATED_TOKENS_INVALID for UserState or onError should called.

Screenshots
Screen Shot 2019-03-18 at 5 15 15 PM

Environment Information (please complete the following information):

  • AWS Android SDK Version: 2.12.0+
  • Device: Motorola Z Play
  • Android Version: 8.0.0
AWSMobileClient Bug

Most helpful comment

Hi @HayTran94 ,

This appears to bug in our logic. We are working on a fix to improve the experience.

All 4 comments

Hi @HayTran94 ,

This appears to bug in our logic. We are working on a fix to improve the experience.

I have been fighting this or a similar issue for a month now with Google Federated sign-in. Possibly related.

2019-03-21 20:06:12.416 25125-25207/com.buntingsoftware.modlist D/AWSMobileClient: run: showSignIn completed
2019-03-21 20:06:12.436 25125-25231/com.buntingsoftware.modlist D/AWSMobileClient: Inspecting user state details
2019-03-21 20:06:12.437 25125-25231/com.buntingsoftware.modlist D/AWSMobileClient: hasFederatedToken: true provider: accounts.google.com
2019-03-21 20:06:12.437 25125-25231/com.buntingsoftware.modlist D/AWSMobileClient: getUserStateDetails: token already federated just fetch credentials
2019-03-21 20:06:12.468 25125-25231/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: 4c63bb88-4c36-11e9-8eb7-55bf836a8581)
        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:1477)
        at com.amazonaws.services.cognitoidentity.AmazonCognitoIdentityClient.getId(AmazonCognitoIdentityClient.java:757)
        at com.amazonaws.auth.AWSAbstractCognitoIdentityProvider.getIdentityId(AWSAbstractCognitoIdentityProvider.java:172)
        at com.amazonaws.mobile.client.AWSMobileClientCognitoIdentityProvider.refresh(AWSMobileClient.java:3395)
        at com.amazonaws.auth.CognitoCredentialsProvider.startSession(CognitoCredentialsProvider.java:678)
        at com.amazonaws.auth.CognitoCredentialsProvider.getCredentials(CognitoCredentialsProvider.java:465)
        at com.amazonaws.auth.CognitoCachingCredentialsProvider.getCredentials(CognitoCachingCredentialsProvider.java:480)
        at com.amazonaws.mobile.client.AWSMobileClient.getUserStateDetails(AWSMobileClient.java:911)
        at com.amazonaws.mobile.client.AWSMobileClient$23.run(AWSMobileClient.java:2733)
        at com.amazonaws.mobile.client.internal.InternalCallback$1.run(InternalCallback.java:101)
        at java.lang.Thread.run(Thread.java:761)

Hi,

Please see if SDK release 2.12.7 fixes this issue for you. We have added the following enhancements:

Updated federatedSignIn() method to contact the service immediately to validate tokens. The signIn() method will also attempt to federated immediately when applicable.

You may see all changes in the changelog

I'm assuming from the thumbs up reaction to the last post that the issue is resolved. Please feel free to open a new issue if the problem persists. We ask this because closed issues are not actively monitored.

Thanks

Was this page helpful?
0 / 5 - 0 ratings