我使用 AWS Amplify 开发了一个简单的应用程序,并使用 amplify add auth 添加了基本身份验证。我选择了“电子邮件或电话号码”选项,它起作用了。现在我想添加更多字段,例如
1- first name
2- city
3- country
4- last name
知道我需要在哪里实施这个吗?我可以使用 Amplify ADMIN UI 执行此操作吗?谢谢:)
从 AWS 控制台,转到用户池并选择
Sign-up Experience
选项卡。您可以运行 amplify console auth
,然后选择 User Pool
为您打开控制台。
向下滚动到自定义属性,然后添加自定义字段,我添加了
icecream
。
注意:自定义属性创建后无法重命名或删除。 Amazon Cognito 在自定义属性名称前面添加“custom:”。
amplify-authenticator
指令,如下所示:
https://ui.docs.amplify.aws/components/authenticator?platform=angular#force-new-password-fields
重要提示:文本字段中的 name
属性的格式为
custom:YOUR_CUSTOM_FIELD
<!-- angular version here -->
<amplify-authenticator>
<ng-template amplifySlot="sign-up-form-fields">
<amplify-sign-up-form-fields></amplify-sign-up-form-fields>
<amplify-text-field
label="Icecream"
autocomplete="false"
placeholder="Your Icecream"
name="custom:icecream"
type="text">
</amplify-text-field>
</ng-template>
</amplify-authenticator>
用于添加额外的标准属性amplify update auth
Walkthrough all the auth configurations
<amplify-authenticator [signUpAttributes]="['address','preferred_username']"></amplify-authenticator>