Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWSMobileClient federated sign in facebook always return onResult even though give wrong token #800

Closed
hyhypepe opened this issue Mar 18, 2019 · 4 comments
Assignees
Labels
bug Something isn't working mobile client Issues with AWS Mobile's client-side Cognito wrapper

Comments

@hyhypepe
Copy link

hyhypepe commented Mar 18, 2019

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
@minbi minbi self-assigned this Mar 18, 2019
@minbi minbi added mobile client Issues with AWS Mobile's client-side Cognito wrapper bug Something isn't working and removed mobile client Issues with AWS Mobile's client-side Cognito wrapper labels Mar 18, 2019
@minbi
Copy link
Contributor

minbi commented Mar 20, 2019

Hi @HayTran94 ,

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

@BillBunting
Copy link
Contributor

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)

minbi added a commit that referenced this issue Apr 2, 2019
…/Facebook from drop-in UI

Updated `federatedSignIn()` method to contact the service immediately to validate tokens. The `signIn()` method will also attempt to federated immediately when applicable. See [issue #800](#800)
Fix Google or Facebook refresh when using the drop-in UI. See [issue #809](#809), [issue #700](#700)
Annotated methods that are designed to be called from UI thread or from a background thread with @anythread and @workerthread, respectively.
minbi added a commit that referenced this issue Apr 2, 2019
…/Facebook from drop-in UI

Updated `federatedSignIn()` method to contact the service immediately to validate tokens. The `signIn()` method will also attempt to federated immediately when applicable. See [issue #800](#800)
Fix Google or Facebook refresh when using the drop-in UI. See [issue #809](#809), [issue #700](#700)
Annotated methods that are designed to be called from UI thread or from a background thread with @anythread and @workerthread, respectively.
sunchunqiang pushed a commit that referenced this issue Apr 2, 2019
…/Facebook from drop-in UI

Updated `federatedSignIn()` method to contact the service immediately to validate tokens. The `signIn()` method will also attempt to federated immediately when applicable. See [issue #800](#800)
Fix Google or Facebook refresh when using the drop-in UI. See [issue #809](#809), [issue #700](#700)
Annotated methods that are designed to be called from UI thread or from a background thread with @anythread and @workerthread, respectively.
@minbi
Copy link
Contributor

minbi commented Apr 3, 2019

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

@minbi
Copy link
Contributor

minbi commented Apr 4, 2019

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

@minbi minbi closed this as completed Apr 4, 2019
awsmobilesdk pushed a commit to awsmobilesdk/aws-sdk-android that referenced this issue Apr 12, 2020
…/Facebook from drop-in UI

Updated `federatedSignIn()` method to contact the service immediately to validate tokens. The `signIn()` method will also attempt to federated immediately when applicable. See [issue aws-amplify#800](aws-amplify#800)
Fix Google or Facebook refresh when using the drop-in UI. See [issue aws-amplify#809](aws-amplify#809), [issue aws-amplify#700](aws-amplify#700)
Annotated methods that are designed to be called from UI thread or from a background thread with @anythread and @workerthread, respectively.
awsmobilesdk pushed a commit to awsmobilesdk/aws-sdk-android that referenced this issue Apr 12, 2020
…/Facebook from drop-in UI

Updated `federatedSignIn()` method to contact the service immediately to validate tokens. The `signIn()` method will also attempt to federated immediately when applicable. See [issue aws-amplify#800](aws-amplify#800)
Fix Google or Facebook refresh when using the drop-in UI. See [issue aws-amplify#809](aws-amplify#809), [issue aws-amplify#700](aws-amplify#700)
Annotated methods that are designed to be called from UI thread or from a background thread with @anythread and @workerthread, respectively.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working mobile client Issues with AWS Mobile's client-side Cognito wrapper
Projects
None yet
Development

No branches or pull requests

3 participants