Is it possible to modify AWS Cognito user attributes in the Lambda triggers

前端 未结 4 1359
说谎
说谎 2021-02-18 14:58

Having a look at the AWS documentation,

https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools-working-with-aws-lambda-triggers.html#cogni

4条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-18 15:48

    Well, the simple solution would be like so, adding this to the "Pre Sign-up Lambda function", taking cue from your code:

    // Modify an existing username...
     event['request']['userAttributes']['name'] = "My_NAME";
    
    // Add an additional attribute...
     event['request']['userAttributes']['custom:sillyname'] = "ANY_NAME";
    
     callback(null, event);
    

    Considering you have added the custom:sillyname attribute for the user pool.

提交回复
热议问题