Skip to content
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

AuthError: Incorrect username or password but can register #3282

Closed
confusionhill opened this issue Oct 5, 2023 · 9 comments
Closed

AuthError: Incorrect username or password but can register #3282

confusionhill opened this issue Oct 5, 2023 · 9 comments
Labels
auth Issues related to the Auth category question General question

Comments

@confusionhill
Copy link

confusionhill commented Oct 5, 2023

Describe the bug

I tried to call the sign in method on amplify

func signIn(username: String, password: String) {
        let options = AWSAuthSignInOptions(authFlowType: .userSRP)
        Amplify.Auth.signIn(
            username: username,
            password: password,
            options: .init(pluginOptions: options)) { result in
            switch result {
            case .success(let resp):
                print("is signed in? ",resp.isSignedIn)
            case .failure(let err):
                print("error bro : ",err)
            }
        }
    }

but the server responded with "AuthError: Incorrect username or password", somehow registration works like a charm without any trouble so what did I do wrong to be exact?

here's my configuration

{
  "auth": {
    "plugins": {
      "awsCognitoAuthPlugin": {
        "IdentityManager": {
          "Default": {}
        },
        "CredentialsProvider": {
          "CognitoIdentity": {
            "Default": {
              "PoolId": "ap-southeast-1:xxxxxx",
              "Region": "ap-southeast-1"
            }
          }
        },
        "CognitoUserPool": {
          "Default": {
            "PoolId": "ap-southeast-1_xxxxxx",
            "AppClientId": "7590jxxxxx",
            "Region": "ap-southeast-1"
          }
        },
        "Auth": {
          "Default": {
            "authenticationFlowType": "USER_SRP_AUTH",
            "OAuth": {}
          }
        }
      }
    }
  }
}

note : I did not set any client secret, so I still have no idea why it doesn't work

Steps To Reproduce

Steps to reproduce the behavior:
1. Register
2. Confirm
3. Login

Expected behavior

Login succesfully without any error

Amplify Framework Version

latest

Amplify Categories

Auth

Dependency manager

Swift PM

Swift version

5.8

CLI version

12.6.0

Xcode version

14.3

Relevant log output

<details>
<summary>Log Messages</summary>


INSERT LOG MESSAGES HERE
```

Is this a regression?

No

Regression additional context

No response

Platforms

No response

OS Version

ios 15.0

Device

emulator

Specific to simulators

No response

Additional context

No response

@thisisabhash thisisabhash added auth Issues related to the Auth category question General question labels Oct 5, 2023
@harsh62
Copy link
Member

harsh62 commented Oct 5, 2023

Would you be able to share how you call signIn method in your code?

Seems like an email is harcoded in the method!

Also share verbose logs enabling verbose logging for Amplify.

@confusionhill
Copy link
Author

confusionhill commented Oct 5, 2023

since it's in my local env, the email is hard coded into the code, is it not possible?

final class LoginViewController: BaseViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        self.view.backgroundColor = .white
        self.signIn(username:"[email protected]", password:"mypassword")
    }
    
    func signIn(username: String, password: String) {
        let options = AWSAuthSignInOptions(authFlowType: .userSRP)
        
        Amplify.Auth.signIn(
            username: "[email protected]",
            password: password,
            options: .init(pluginOptions: options)) { result in
            switch result {
            case .success(let resp):
                print("is signed in? ",resp.isSignedIn)
            case .failure(let err):
                print("error bro : ",err)
            }
        }
    }

}

@thisisabhash
Copy link
Member

The emails are different.

self.signIn(username:"[email protected]", password:"mypassword")

Amplify.Auth.signIn(
            username: "[email protected]",

@confusionhill
Copy link
Author

The emails are different.

self.signIn(username:"[email protected]", password:"mypassword")

Amplify.Auth.signIn(
            username: "[email protected]",

it was a typo, I've updated it

@confusionhill
Copy link
Author

well i tried to debug the library and found this

what does it indicate? what ar the insights?
Screenshot 2023-10-06 at 13 08 56

@confusionhill
Copy link
Author

well i tried to debug the library and found this

what does it indicate? what ar the insights? Screenshot 2023-10-06 at 13 08 56

how about this one? i find it hard to debug
Screenshot 2023-10-06 at 13 43 53
and know what it means

@harsh62
Copy link
Member

harsh62 commented Oct 6, 2023

It says that you've exceeded the password attempt count. I would recommend to create a new user and is you still see an error, please share verbose logs with us.

You can enable verbose logging to the console by doing this before calling Amplify.configure:

Amplify.Logging.logLevel = .verbose

@confusionhill
Copy link
Author

It says that you've exceeded the password attempt count. I would recommend to create a new user and is you still see an error, please share verbose logs with us.

You can enable verbose logging to the console by doing this before calling Amplify.configure:

Amplify.Logging.logLevel = .verbose

still doesn't give me any hint

error bro :  AuthError: Incorrect username or password.
Recovery suggestion: Check whether the given values are correct and the user is authorized to perform the operation.

@harsh62
Copy link
Member

harsh62 commented Oct 10, 2023

@confusionhill Would you be able to share the entire log? Everything that Amplify is doing from the start to better understand what is going on here.

@ruisebas ruisebas added the pending-community-response Issue is pending response from the issue requestor label Oct 12, 2023
@atierian atierian added the closing soon This issue will be closed in 7 days unless further comments are made. label Oct 21, 2023
@github-actions github-actions bot removed pending-community-response Issue is pending response from the issue requestor closing soon This issue will be closed in 7 days unless further comments are made. labels Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auth Issues related to the Auth category question General question
Projects
None yet
Development

No branches or pull requests

5 participants