Amplify-js: Trying to sign in unverified email but get error 400 POST https://cognito-identity.us-east-1.amazonaws.com/

Created on 9 Mar 2018  路  5Comments  路  Source: aws-amplify/amplify-js

Do you want to request a feature or report a bug?
help wanted, thanks

What is the current behavior?
I am using manual setup following aws-amplify doc providing identityPoolId, region, userPoolId and userPoolWebClientId.
and
Auth.signUp({ username: email, password: pwd});
Auth.signIn(email, password)

https://aws.github.io/aws-amplify/media/authentication_guide.html#6-federated-identity
There is error 400 when the app starts.
I am able to register users and they appear in the user pool specified.
However, when I try to login, I see error 400.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than AWS Amplify.

What is the expected behavior?
Expect to be able to login.

Which versions of Amplify, and which browser / OS are affected by this issue? Did this work in previous versions?
Amplify 0.2.9

You can turn on the debug mode to provide more info for us by setting window.LOG_LEVEL = 'DEBUG'; in your app.

Auth question

Most helpful comment

Also, you can add: window.LOG_LEVEL='DEBUG'; , this to your file where you call Amplify.configure() to see all the log statements of Amplify calls. This should help you with the debugging too.

All 5 comments

Hi @Jun711,

Can you please share the Error message too? Error code 400 from Cognito maps to a few different ones: https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/CommonErrors.html

Also, you can add: window.LOG_LEVEL='DEBUG'; , this to your file where you call Amplify.configure() to see all the log statements of Amplify calls. This should help you with the debugging too.

I think I have the same problem:
my AWS is set only with User Pool, User Pool Web Client BUT NO Identity Pool.

I expected to have a AuthFlowType: 'USER_PASSWORD_AUTH' (a.k.a simple user+pass)
buy the library is defaulted to "USER_SRP_AUTH" which requires identity Pool setup.

error on the 400 call is:
{"__type":"NotAuthorizedException","message":"Token is not from a supported provider of this identity pool."}

Is there a simple way to implement basic auth flow "USER_PASSWORD_AUTH", just with username and pass?

@nidsharm I think it was due to IAM roles, permissions, policies and trust issues. it is solved now. thanks.

@demorf I think aws-amplify doesn't support 'USER_PASSWORD_AUTH' AuthFlowType as of now.

Hi @demorf ,

Amplify is increasing its coverage of the amazon-cognito-identity-js sdk as we go. The idea is to support the most popular use cases first. As we are moving to the plugin structure for our components, your use case will also be covered.
For the time being, you can directly use the amazon-cognito-identity-js sdk and use the authenticateUser call (https://github.com/aws/aws-amplify/blob/master/packages/amazon-cognito-identity-js/src/CognitoUser.js#L197). This will take care of your AuthFlowType.

Also, if you have any issues integrating the sdk with your app, you can look into the initial commits of our starters (https://github.com/awslabs/aws-mobile-react-native-starter, https://github.com/awslabs/aws-mobile-react-sample) to see how to get the integration correct.

Thanks.

Was this page helpful?
0 / 5 - 0 ratings