I'm unable to get AWS Amplify to authenticate to my AWS Cognito setup. I use the following code to set up.
import Amplify from 'aws-amplify-react-native';
import { Auth } from 'aws-amplify-react-native';
Amplify.configure({
Auth: {
IdentityPoolId: 'us-west-2:XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX',
region: 'us-west-2',
UserPoolId: 'us-west-2_XXXXXXXX',
ClientId: 'XXXXXXXXXXXXXXX'
}
});
and this code to sign in
Auth.signIn(this.state.username, this.state.password)
.then(user => console.log(user))
.catch(err => console.log(err)); //"No userPool" logged here
However I get the error No userPool logged as an error.
The example here: https://github.com/aws/aws-amplify/blob/master/media/authentication_guide.md has some of the configuration attributes starting with a lower case, however when I follow that I get the Red Screen.
It is just wrong config. The example in guide is:
import Amplify from 'aws-amplify';
Amplify.configure({
Auth: {
identityPoolId: 'XX-XXXX-X:XXXXXXXX-XXXX-1234-abcd-1234567890ab', //REQUIRED - Amazon Cognito Identity Pool ID
region: 'XX-XXXX-X', // REQUIRED - Amazon Cognito Region
userPoolId: 'XX-XXXX-X_abcd1234', //OPTIONAL - Amazon Cognito User Pool ID
userPoolWebClientId: 'XX-XXXX-X_abcd1234', //OPTIONAL - Amazon Cognito Web Client ID
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With