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!
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With