gpt4 book ai didi

javascript - 注册时出错,电子邮件 : the attribute is required

转载 作者:行者123 更新时间:2023-12-02 22:55:14 25 4
gpt4 key购买 nike

我正在尝试使用 AWS 设置身份验证。输入用户名、密码、电子邮件并单击“注册”后,我收到一条错误消息:“注册时出错,属性不符合架构,电子邮件:该属性是必需的”

在 AWS Cognito 中,我在用户池中选择的选项是1.) 用户名​​-用户可以使用用户名和可选的多个替代名称来注册和登录。2.) 在所需的标准属性下,我选择了电子邮件。

我的代码片段:


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))

最佳答案

当您创建用户池时,您选择了所需的属性,您的个人池中是否勾选了电子邮件?

要登录,您需要在 AWS 中激活用户名登录!直接来自您的用户池。

enter image description here

我想你忘记了一个属性:

Auth.signUp({
username: this.state.username,
password:this.state.password,
attributes: {
email: this.state.email
}
})

这是我的工作代码:

Auth.signUp({
'username': mongoUser.preferred_username,
'password': registrationUser.password,
'attributes': {
'email': mongoUser.email
}
})

关于javascript - 注册时出错,电子邮件 : the attribute is required,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58014811/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com