1 Answer
- Newest
- Most votes
- Most comments
0
Hi there,
You should be able to achieve this using the post confirmation lambda trigger as discussed here: https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-lambda-post-confirmation.html
Then looking at available API, you can ask Lambda to generate the token for you using AdminInitiateAuth API as per this doc: https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_AdminInitiateAuth.html
For the Auth Flow: The type of authentication. Use USER_PASSWORD_AUTH for this scenario. This will require parameters like USERNAME and PASSWORD. For the passwordless flow, you can generate a temporary value for the PASSWORD field, then authenticate the user with the username.
Relevant content
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 3 years ago

Thanks AmerO for your fast response!
I appreciate the suggestion of using the AdminInitiateAuth API along with the post-confirmation Lambda trigger. However, I'm having trouble understanding how to apply this approach within my current passwordless flow, specifically since I don't have a password to authenticate with (as the flow skips password entry entirely).
Could you clarify how I could generate a temporary password or bypass the password requirement in this scenario? Maybe with a short (pseudo) code snippet? My users only receive a one-time code via email during sign-up and login, and the random password used by the mobile app client for sign-up is not stored anywhere after sending the sign-up request.
Should I be generating some kind of temporary password behind the scenes in the Lambda, or is there a different flow you recommend for passwordless use cases?
Any further guidance would be much appreciated!
Thank you in advance!