AWS Cognito Lambda 触发器用户属性示例
AWS Cognito Lambda Trigger user attributes example
我正在使用 Cognito 和 Lambda 创建一个微型 API。我想使用 Cognito Lambda 触发器在新用户注册(通过 Facebook)和用户登录时做一些事情。
我在谷歌上搜索了很多,当然也跟着 Amazon's guide 但是我找不到任何关于“userAttributes”字典的例子。
有人可以提供此触发器的示例吗?
userAttributes
字典包含可用属性,如姓名、电子邮件、phone 号码等。实际可用属性由为您的应用程序客户端设置的属性读取权限决定,如果是外部像 Facebook 这样的提供商,在 Userpool 中定义了属性映射。正如@Kannaiyan 所说,了解这些值的最佳方法是在您的 lambda 中打印它们。
以下是 userAttributes
所需值的详细信息
userAttributes This field is required.
It must contain one or more name-value pairs representing user
attributes to be stored in the user profile in your user pool. You can
include both standard and custom user attributes. Custom attributes
require the custom: prefix to distinguish them from standard
attributes. For more information see Custom attributes.
Note
In order for users to reset their passwords in the forgot-password
flow, they must have either a verified email or a verified phone
number. Amazon Cognito sends a message containing a reset password
code to the email or phone number in the user attributes.
Attributes Requirement Any attributes marked as required when you
created your user pool If any required attributes are missing during
the migration, default values will be used. username Required if you
have configured your user pool with email and/or preferred_username
aliases in addition to username for sign-in, and the user has entered
an email or phone number to sign-in.
Otherwise, it is optional and will be used as the username instead of
the username entered by the user.
Note
username must be unique in the user pool.
cognito:mfa_enabled Required if MFA is configured as optional in the
User Pool. This attribute specifies whether MFA is enabled for the
user.
我正在使用 Cognito 和 Lambda 创建一个微型 API。我想使用 Cognito Lambda 触发器在新用户注册(通过 Facebook)和用户登录时做一些事情。
我在谷歌上搜索了很多,当然也跟着 Amazon's guide 但是我找不到任何关于“userAttributes”字典的例子。
有人可以提供此触发器的示例吗?
userAttributes
字典包含可用属性,如姓名、电子邮件、phone 号码等。实际可用属性由为您的应用程序客户端设置的属性读取权限决定,如果是外部像 Facebook 这样的提供商,在 Userpool 中定义了属性映射。正如@Kannaiyan 所说,了解这些值的最佳方法是在您的 lambda 中打印它们。
以下是 userAttributes
所需值的详细信息userAttributes This field is required.
It must contain one or more name-value pairs representing user attributes to be stored in the user profile in your user pool. You can include both standard and custom user attributes. Custom attributes require the custom: prefix to distinguish them from standard attributes. For more information see Custom attributes.
Note
In order for users to reset their passwords in the forgot-password flow, they must have either a verified email or a verified phone number. Amazon Cognito sends a message containing a reset password code to the email or phone number in the user attributes.
Attributes Requirement Any attributes marked as required when you created your user pool If any required attributes are missing during the migration, default values will be used. username Required if you have configured your user pool with email and/or preferred_username aliases in addition to username for sign-in, and the user has entered an email or phone number to sign-in.
Otherwise, it is optional and will be used as the username instead of the username entered by the user.
Note
username must be unique in the user pool.
cognito:mfa_enabled Required if MFA is configured as optional in the User Pool. This attribute specifies whether MFA is enabled for the user.