Question:
I am trying to set up authentication using AWS.
After entering username, password, email, and clicking Sign Up, I got an error message that says
“error signing up, Attributes did not conform to the schema, email: the attribute is required”
In AWS Cognito, the options I selected in my User Pool were that the
1.) Username-users can use a username and optionally multiple alternatives to sign up and sign in.
2.) Under the standard attributes required, I selected email.
Bits of my Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
state = { username:'', email:'', password:'', confirmationCode:'' } onChangeText(key, value) { this.setState({ [key]: value }) } signUp() { Auth.signUp({ username: this.state.username, password:this.state.password, attribute: { email: this.state.email } }) .then(() => console.log('successful sign up')) .catch(err => console.log('error signing up!:', err)) |
Answer:
When you created your user pool, you selected the required attributes, is email ticked in your personal pool?
For signin, you need to activate the username sign in in AWS! Directly from your user pool.
I think you forgot an s to attribute:
1 2 3 4 5 6 7 8 |
Auth.signUp({ username: this.state.username, password:this.state.password, attributes: { email: this.state.email } }) |
Here is my working code:
1 2 3 4 5 6 7 8 |
Auth.signUp({ 'username': mongoUser.preferred_username, 'password': registrationUser.password, 'attributes': { 'email': mongoUser.email } }) |