-
Notifications
You must be signed in to change notification settings - Fork 199
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
Amplify.Auth.confirmResetPassword does not throw exception when username not found #3209
Comments
Hi @jmhuang12 , thanks for opening this issue. Here are the steps to modify this setting:
Having said that, you should still be getting a |
====== Thanks for your prompt reply. I have Prevent User Existence Errors disabled in the cognito app client console. I get a success when calling In fact, my XCode compiler tells me that "'catch' block is unreachable because no errors are thrown in 'do' block " when calling |
🤔 I'm confused by that, confirmResetPassword(for:with:confirmationCode) not only So it shouldn't compile unless you call it like this: try await Amplify.Auth.confirmResetPassword(
for: username,
with: newPassword,
confirmationCode: confirmationCode
) Are you sure you are using Amplify version |
Yes indeed I have Amplify version (1.30.4) installed instead of version 2.12.0. please see the picture for my podfile.lock. Amplify was installed using cocoapod. However, i cannot update Amplify to 2.12.0 by running "pod install --repo-update". How do i update Amplify to the latest version?
|
Amplify 2.x is only available through Swift Package Manager and we currently don't have any plans to support CocoaPods. Amplify 1.x Auth APIs behave differently: they are not async and don't throw errors, but you need to handle the result by either providing a completion handler closure or retaining the returned For example, something like this: Amplify.Auth.confirmResetPassword(for: username, with: newPassword, confirmationCode: confirmationCode) { result in
switch result {
case .success:
print("Password reset confirmed")
case .failure(let error):
print("Reset password failed with error \(error)")
guard let cognitoAuthError = error.underlyingError as? AWSCognitoAuthError else {
print("Unexpected error: \(error)")
return
}
// Handle cognitoAuthError...
}
} You can find more information in the v1 doc page Having said that, we encourage you to migrate, as Amplify v1 is now in Maintenance Mode until May 31st, 2024. This means that we will continue to include updates to ensure compatibility with backend services and security, but no new features will be introduced. |
Amplify v2 is added using SPM. thank you for your help! closing issue. |
Describe the bug
I have a question regarding the confirmResetPassword method.
Shouldn't userNotFoundException be thrown when you call the confirmResetPassword method for an user who is not in Cognito User Pool?
Also shouldn't codeMismatchException be thrown when calling confirmResetPassword for a wrong confirmation code?
per https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_ForgotPassword.html#API_ForgotPassword_Errors
see also https://docs.amplify.aws/lib/auth/password_management/q/platform/ios/#reset-password.
However, no exception is thrown for both of these scenarios.
I also referred to a similar issue -> aws-amplify/amplify-js#4699
However, "Prevent User Existence Errors turned to Enabled" under app client no longer has a "legacy" option.
Please help. thanks
Steps To Reproduce
Expected behavior
exception thrown for nonexistent user name or wrong confirmation code
Amplify Framework Version
2.12.0
Amplify Categories
Auth
Dependency manager
Swift PM
Swift version
5.8.1
CLI version
12.1.1
Xcode version
14.3.1
Relevant log output
Is this a regression?
No
Regression additional context
No response
Platforms
iOS
OS Version
17
Device
iphone11
Specific to simulators
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: