-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't change the status of "FORCE_CHANGE_PASSWORD" users #1340
Comments
@blazsek the user need to sign in with the temporary password first, the flow is like: Auth.signIn(username, temp_password)
.then(user => {
if (user.challengeName === 'NEW_PASSWORD_REQUIRED') {
Auth.completeNewPassword(user, new_password, requiredAttributes)
.then(user => {
});
}
} Maybe you can have look at this and this |
Hi @powerful23 I have a similar problem but I get This ia a code snippet of what I have:
Any help would be great.. |
looks like it's not possible to reset the user password if they are in the unfortunately, might have to use the aws-sdk with a cloud function to handle this. otherwise I can see a solution where you create users with the same initial password and automatically complete the |
The initial question seems to have been answered. Closing. Please reopen this if you have any further questions or concerns. |
As they say better late, then never ;)
this should solve Your issue |
this does not work unless you pass the arguments as
|
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs. Looking for a help forum? We recommend joining the Amplify Community Discord server |
I'm developing a React app, and implementing the authentication with AWS Amplify and Cognito. I'm not using the withAuthenticator HOC because of a custom sign-in page. I sign up users as an administrator with the AWS CLI, which means they receive the FORCE_CHANGE_PASSWORD status by default.
On the login page, I'd like to detect the user's status after capturing their login details so the app would redirect the user to the forgot password flow in case of a FORCE_CHANGE_PASSWORD status.
However, I find absolutely no way to retrieve the status of a user. All of the following methods omit this parameter: currentAuthenticatedUser(), currentSession(), currentUserInfo(), currentUserPoolUser(), currentCredentials().
I even added a custom attribute "isConfirmed" that would be initialized with a "no" value but the Auth.currentAuthenticatedUser() (as well as other similar methods) don't return a user object for users with the state FORCE_CHANGE_PASSWORD.
Secondly, I can't seem to find any way to initiate the Auth.forgotPassword method for a user with the state FORCE_CHANGE_PASSWORD. If I call the forgotPassword method for a new user, I get the following message: User password cannot be reset in the current state.
To sum up:
#1: I can't detect the state of the user.
#2: I can't call the forgotPassword method for users with the FORCE_CHANGE_PASSWORD STATE.
Any help would be greatly appreciated.
The text was updated successfully, but these errors were encountered: