簡體   English   中英

用戶無法通過 AWS Cognito 使用其電子郵件和密碼進行身份驗證

[英]Users unable to authenticate with their email and password with AWS Cognito

我有一個測試用戶已通過 AWS Cognito 確認了他們的電子郵件。 我收到NotAuthorizedException: Incorrect username or password. 當我嘗試使用他們的電子郵件和密碼向他們發起身份驗證時。 目前,我只能使用用戶名對用戶進行身份驗證。

這是我與用戶啟動身份驗證的方式。 我在USERNAME字段中提供他們的電子郵件。

public initiateAuth(args: WithAuthFlowType<InitiateAuth>): Promise<InitiateAuthCommandOutput> {
    //https://docs.aws.amazon.com/cognito/latest/developerguide/amazon-cognito-user-pools-authentication-flow.html

    return new CognitoIdentityProviderClient({region: "us-east-1"}).send(
        new InitiateAuthCommand({ //https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-cognito-identity-provider/classes/initiateauthcommand.html
            ClientId: "<some_client_id>",
            AuthFlow: AuthFlowType.USER_PASSWORD_AUTH,
            AuthParameters: {
                USERNAME: "foo@bar.com",
                PASSWORD: "1234...",
            },
        })
    );
}

我相信我很好地配置了 AWS Cognito。 在控制台中,它顯示用戶可以使用他們的電子郵件登錄。 如何讓我的用戶使用他們的電子郵件和密碼進行身份驗證?

AWS Cognito 控制台

發現這是用戶錯誤。 用戶在他們的電子郵件中有一個句號。

f.bar@baz.com

用戶試圖以

fbar@baz.com

這就是他們無法登錄的原因。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM