我正在使用AWS Amplify Cognito创建无服务器身份验证后端,并且将Angular用作前端框架。我没有使用内置的aws UI组件来登录/注册界面,而是创建了自己的用户界面。当我尝试将用户对象提交到Auth.SignUp()
时,在AWS Amplify文档中找不到与该对象相关的文档。如果您自己实施了此操作,请在此处共享。
如何为AWS Amplify Cognito Auth.SignUp()方法定义用户对象?
•
问答
biyesheng630 回答:如何为AWS Amplify Cognito Auth.SignUp()方法定义用户对象?
这是我(在Angular中)实现它的方式
身份验证服务:
import Auth from '@aws-amplify/auth';
...
customSignupFunction(usrname,psw,phone) {
const username = usrname;
const password = psw;
const phone_number = phone;
return Auth.signUp({
username,password,attributes: {
phone_number,//more attributes
}
}).then(res => {
//do something
}).catch(err => console.error(err))
}