Dan*_*zes 9 amazon-web-services amazon-cognito
我试图通过 nodeJS 在我的认知用户池中创建一个新用户,但我不断收到错误的电话号码错误……但我使用相同格式的号码通过 SNS 服务发送短信,我不明白为什么会发生这种情况
报名方式:
module.exports.post = async (username,password,email,phoneNumber) => {
const environment = {
UserPoolId: xxxxxxx,
ClientId: xxxxxx,
}
return new Promise((reject,resolve) => {
const userPool = new AmazonCognitoIdentity.CognitoUserPool(environment);
const emailData = {
Name: 'Email',
Value: email
};
const userData = {
Name: 'Usuário',
Value: username
};
const phoneData = {
Name: 'Telefone',
Value: phoneNumber
};
const emailAttribute = new AmazonCognitoIdentity.CognitoUserAttribute(emailData);
const userAttribute = new AmazonCognitoIdentity.CognitoUserAttribute(userData);
const phoneAttribute = new AmazonCognitoIdentity.CognitoUserAttribute(phoneData);
userPool.signUp(username,password,[emailAttribute,userAttribute, phoneAttribute], null, (err,data) => {
if(err) console.log(err);
resolve(data);
});
});
}
Run Code Online (Sandbox Code Playgroud)
我通过的数字格式:
+5521979724910
Run Code Online (Sandbox Code Playgroud)
错误 :
{ code: 'InvalidParameterException',
name: 'InvalidParameterException',
message: '1 validation error detected: Value \'phone number\' at \'userAttributes.2.member.name\' failed to satisfy constraint: Member must satisfy regular expression pattern: [\\p{L}\\p{M}\\p{S}\\p{N}\\p{P}]+' }
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
Ale*_*exK 17
该Name属性值应该是phone_number代替Telefone
const phoneData = {
Name : 'phone_number',
Value : '+15555555555'
};
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
13019 次 |
| 最近记录: |