Cognito验证用户失败

时间:2018-10-11 12:53:41

标签: angular amazon-cognito

当我尝试使用刚创建的用户名登录时遇到问题。

我的请求auth的响应是:“消息:用户名或密码错误。”

我做错了什么?

authenticate(username: string, password: string, callback: CognitoCallback) {
        console.log('UserLoginService: starting the authentication');

        const authenticationData = {
            Username: username,
            Password: password,
        };
        const authenticationDetails = new AuthenticationDetails(authenticationData);

        const userData = {
            Username: username,
            Pool: this.cognitoUtil.getUserPool()
        };

        console.log('UserLoginService: Params set...Authenticating the user');
        const cognitoUser = new CognitoUser(userData);
        console.log('UserLoginService: config is ' + AWS.config);
        const that = this;
        cognitoUser.authenticateUser(authenticationDetails, {
            newPasswordRequired: (userAttributes, requiredAttributes) => console.log('change it'),
            onSuccess: result => this.onLoginSuccess(callback, result, username),
            onFailure: err => this.onLoginError(callback, err)
        });
    }

谢谢。

0 个答案:

没有答案