How do I reset a Cognito user's password that has expired?


How do I reset a Cognito user's password that has expired?



We're using Cognito. All is well. I added a user using the AdminCreateUser API, and they received their temporary password. Unfortunately they waited over a month to login, and now when they try to login with their temporary password, Cognito returns this error:


User account has expired, it must be reset by an administrator.



How do I do that? I don't see any reset button in the Cognito UI. Is there a CLI or API that I can call?




1 Answer
1



Currently admin-reset-user-password and admin-enable-user does not work for an expired user, the way you would reset an expired user is to call AdminCreateUser again with the parameter MessageAction value = 'RESEND'



For example Via CLI command:


aws cognito-idp admin-create-user --region us-east-1 --user-pool-id us-east-1_youruserpoolid --username theusername --message-action RESEND



From the documentation:



"Set to 'RESEND' to resend the invitation message to a user that
already exists and reset the expiration limit on the user's account."



Once you have reset the user, the user will need to change the temporary password otherwise they will be put back into this state again once they have exceeded the expiration time period (I believe this is normally 90 days unless specified otherwise).






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

api-platform.com Unable to generate an IRI for the item of type

How to set up datasource with Spring for HikariCP?

Display dokan vendor name on Woocommerce single product pages