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

`signIn` method is trying to perform federated sign in

Open sarbagyastha opened this issue 3 years ago • 7 comments

Describe the bug I'm getting Federation is not enabled, please check if you have CognitoIdentity configured issue when I try to use the signIn method.

The last paragraph of this doc page mentions that If you are using a Cognito User Pool, without a Cognito Identity Pool, you can omit the CredentialsProvider section in the configuration.

But getting the Federation not enabled issue when omitting the CredentialsProvider section.

Expected Behavior The signIn method should not require Identity Pool Id to work.

Platform Amplify Flutter current supports iOS and Android. This issue is reproducible in (check all that apply):

  • [x] Android
  • [ ] iOS

sarbagyastha avatar Feb 16 '22 14:02 sarbagyastha

@sarbagyastha Can you please post your amplifyconfiguration? The actual values can be redacted, as long as the keys are present.

haverchuck avatar Feb 16 '22 16:02 haverchuck

@sarbagyastha Is this an exception you are actually receiving in your Flutter app, or logs you are seeing? When I see this exception, it is printed in logs as an artifact of the underlying Android SDK, but signin still works.

haverchuck avatar Feb 16 '22 19:02 haverchuck

@sarbagyastha Can you also try adding the 'IdentityManager' key to your amplifyconfig, like so:

    "auth": {
        "plugins": {
            "awsCognitoAuthPlugin": {
                "UserAgent": "aws-amplify-cli/0.1.0",
                "Version": "0.1.0",
                "IdentityManager": {
                    "Default": {}
                },
                "CognitoUserPool": {
                    "Default": {
                        "PoolId": "us-west-2_xxxxxxxxx",
                        "AppClientId": "xxxxxxxxxxxxxxxxxxx",
                        "Region": "us-west-2"
                    }
                },

If that works, I may need to open an issue in another library. Thanks.

haverchuck avatar Feb 17 '22 20:02 haverchuck

@haverchuck This is exactly the same config map I've been using.

The signIn method is actually trying to perform federatedSignIn in native side. Should it be like that ?

sarbagyastha avatar Feb 18 '22 00:02 sarbagyastha

@sarbagyastha I think the underlying sdks might try to perform that operation, but the signIn operation should still work and you should have access to user pool tokens. Is that not happening?

haverchuck avatar Feb 18 '22 20:02 haverchuck

@haverchuck Sorry for the late response.

@sarbagyastha I think the underlying sdks might try to perform that operation, but the signIn operation should still work and you should have access to user pool tokens. Is that not happening?

No, sign in was not successful. i get the following error logs.

But the same thing is working fine on iOS.

W/CognitoUserSession(23497): CognitoUserSession is not valid because idToken is null.
D/AWSMobileClient(23497): Sending password.
D/AWSMobileClient(23497): Using USER_SRP_AUTH for flow type.
D/EGL_emulation(23497): app_time_stats: avg=1785.27ms min=12.10ms max=19701.98ms count=22
D/EGL_emulation(23497): app_time_stats: avg=23.70ms min=2.80ms max=336.89ms count=33
D/EGL_emulation(23497): app_time_stats: avg=3.88ms min=2.47ms max=7.24ms count=60
D/AWSMobileClient(23497): _federatedSignIn: Putting provider and token in store
W/AWSMobileClient(23497): Failed to federate tokens during sign-in
W/AWSMobileClient(23497): java.lang.Exception: Federation is not enabled, please check if you have CognitoIdentity configured.
W/AWSMobileClient(23497): 	at com.amazonaws.mobile.client.AWSMobileClient$10.run(AWSMobileClient.java:1801)
W/AWSMobileClient(23497): 	at com.amazonaws.mobile.client.internal.InternalCallback.await(InternalCallback.java:115)
W/AWSMobileClient(23497): 	at com.amazonaws.mobile.client.AWSMobileClient.federatedSignInWithoutAssigningState(AWSMobileClient.java:1754)
W/AWSMobileClient(23497): 	at com.amazonaws.mobile.client.AWSMobileClient$6$1.onSuccess(AWSMobileClient.java:1243)
W/AWSMobileClient(23497): 	at com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUser$6.onSuccess(CognitoUser.java:1102)
W/AWSMobileClient(23497): 	at com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUser$27.run(CognitoUser.java:3135)
W/AWSMobileClient(23497): 	at com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUser$24.run(CognitoUser.java:3002)
W/AWSMobileClient(23497): 	at com.amazonaws.mobileconnectors.cognitoidentityprovider.continuations.AuthenticationContinuation.continueTask(AuthenticationContinuation.java:147)
W/AWSMobileClient(23497): 	at com.amazonaws.mobile.client.AWSMobileClient$6$1.getAuthenticationDetails(AWSMobileClient.java:1295)
W/AWSMobileClient(23497): 	at com.amazonaws.mobileconnectors.cognitoidentityprovider.CognitoUser.getSession(CognitoUser.java:1035)
W/AWSMobileClient(23497): 	at com.amazonaws.mobile.client.AWSMobileClient$6.run(AWSMobileClient.java:1228)
W/AWSMobileClient(23497): 	at com.amazonaws.mobile.client.internal.InternalCallback$1.run(InternalCallback.java:101)
W/AWSMobileClient(23497): 	at java.lang.Thread.run(Thread.java:1012)
D/AWSMobileClient(23497): Inspecting user state details
D/AWSMobileClient(23497): hasFederatedToken: false provider: cognito-idp.us-west-2.amazonaws.com/us-west-2_XXXXXXXXX

sarbagya-acme avatar Mar 01 '22 12:03 sarbagya-acme

I am still seeing this issue with 0.6.0

rhamnett avatar Jun 29 '22 01:06 rhamnett

Hey folks - Apologies the very delayed response. If you are still facing this issue, can you please provide your full amplify config, with sensitive info removed?

Jordan-Nelson avatar Mar 28 '23 15:03 Jordan-Nelson

I am going to close this out since we do not have steps to reproduce and have not heard back.

Jordan-Nelson avatar Apr 10 '23 16:04 Jordan-Nelson