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: .md has some of the configuration attributes starting with a lower case, however when I follow that I get the Red Screen.
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./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.
Share edited Dec 19, 2017 at 17:30 Adrian Hall 8,0351 gold badge20 silver badges26 bronze badges asked Nov 29, 2017 at 10:00 user1176516user1176516 1032 silver badges5 bronze badges2 Answers
Reset to default 5It 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
}
});
I worked it out going through the AWS code, the userPoolWebClientId was required, and as Richard Zhang pointed out above I was using the wrong attributes.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745044794a4608029.html
评论列表(0条)