7

我正在使用AWS的放大框架在 Vue.js 中构建一个 webapp。

至于现在,我正在使用cognito服务对用户进行身份验证。

我想在用户首次创建帐户时触发 lambda 函数。我已经使用以下命令创建了一个 lambda 函数:

amplify function add

我使用以下命令测试了我的功能:

amplify function invoke myLambdaFunction

现在我想在用户创建帐户时触发此功能。

知道我该怎么做吗?

谢谢你,亚历克西斯

4

2 回答 2

11

您可以使用 cli 执行此操作:

% amplify auth update
What do you want to do? Walkthrough all the auth configurations
...
? Do you want to configure Lambda Triggers for Cognito? Yes 
? Which triggers do you want to enable for Cognito Pre Sign-up
? What functionality do you want to use for Pre Sign-up
Do you want to edit your custom function now? Yes

然后你可以在这个新生成的函数中添加你的逻辑

于 2019-11-06T22:00:04.620 回答
2

我能够使用这些选项创建触发器:请参阅文档

$ amplify auth update

? What do you want to do? Walkthrough all the auth configurations
? Select the authentication/authorization services that you want to use: User Sign-Up, Sign-In, connected with AWS IAM controls (Enables per-user Storage features fo
r images or other content, Analytics, and more)
? Allow unauthenticated logins? (Provides scoped down permissions that you can control via AWS IAM) No
? Do you want to enable 3rd party authentication providers in your identity pool? No
? Do you want to add User Pool Groups? No
? Do you want to add an admin queries API? No
? Multifactor authentication (MFA) user login options: OPTIONAL (Individual users can use MFA)
? For user login, select the MFA types: SMS Text Message
? Please specify an SMS authentication message: Your authentication code is {####}
? Email based user registration/forgot password: Enabled (Requires per-user email entry at registration)
? Please specify an email verification subject: Your verification code
? Please specify an email verification message: Your verification code is {####}
? Do you want to override the default password policy for this User Pool? No
? Specify the app's refresh token expiration period (in days): 120
? Do you want to specify the user attributes this app can read and write? No
? Do you want to enable any of the following capabilities? 
? Do you want to use an OAuth flow? No
? Do you want to configure Lambda Triggers for Cognito? Yes
? Which triggers do you want to enable for Cognito 
于 2020-12-28T17:28:19.680 回答