3

Does someone know if it is possible in aws Cognito to get the user's 'sub' in one of the Lambda Trigger functions you can use? (especially in Pre Sign-Up or Post Confirmation)

Since it is recommended to use the 'sub' attribute as primary key it would be great to have access to it.

Thank you!

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
Björn
  • 608
  • 2
  • 7
  • 19

1 Answers1

5

You can refer to this file for event structs. It's in golang, however, the same struct should be there for other languages.

Then you can retrieve the sub attribute from userAttributes object. Other fields (e.g. cognito:user_status, email, email_verified, name) could be used based on your requirement.

sayboras
  • 4,897
  • 2
  • 22
  • 40