vue.js - 为什么我的 AWS-Amplify 注册请求不包含某些参数?
问题描述
为什么我的 Vuejs 应用程序中的 AWS Amplify 注册请求不包含指定参数?
我正在调用 AWS Amplify 库中描述的 signUp 方法...
/**
* Sign up with username, password and other attributes like phone, email
* @param {String | object} params - The user attributes used for signin
* @param {String[]} restOfAttrs - for the backward compatability
* @return - A promise resolves callback data if success
*/
signUp(params: string | SignUpParams, ...restOfAttrs: string[]): Promise<ISignUpResult>;
这是我调用signUp方法的包装方法......
export async function register(email, password, username, phone_number) {
return Auth
.signUp({ username, password }, email, phone_number)
.then(data => console.log())
.catch(error => {
notification.warning({
message: error.code,
description: error.message,
})
})
}
通过控制台日志语句,我确认我正在将正确的变量传递给包装器方法。例如...
email: Sally1234@gmail.com,
password: Sally123!,
username: Sally1234@gmail.com (yes, this username matches the email - to satisfy another Amplify requirement),
phone_number: +18081124351
这是我得到的错误。
InvalidParameterException
Attributes did not conform to the schema: name: The attribute is required phone_number: The attribute is required
解决方案
尝试像这样调用函数:
Auth.signUp({ username, password, attributes: { email, phone_number } } );
推荐阅读
- mysql - 全新 Lucee 5.2.7.63 安装无法连接到全新 MySQL 8 安装
- asp.net - 如何获取在 ASP.NET MVC 中呈现部分视图的 .cshtml 文件的文件名?
- ios - 将焦点从 UITextView 更改为 UITextField 会破坏约束
- python - 在 Python 中使用权重拟合对数正态分布的正确方法
- sql - 使用子查询和联接的 SQL 查询性能
- excel - VBA,格式化/未知问题导致 vba 无法工作
- dataset - 用于物体检测和分类的 kitti 数据集 3D 激光雷达点云数据
- mysql - 在 Rails 中使用英语模型和西班牙语数据库
- python - Python:根据位置、括号和括号从列表中获取每个元素
- javascript - 我可以使用中继更新器配置来更新简单的 graphQL 列表吗?