本文介绍了无法在Amazon Cognito Userpools中验证客户端的秘密哈希的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我被困在 Amazon Cognito身份用户池流程中。

I am stuck at "Amazon Cognito Identity user pools" process.

我尝试了所有可能的代码来在cognito用户池中对用户进行身份验证。但是我总是收到错误消息,说错误:无法验证客户端4b ******* fd的秘密哈希。

I tried all possible codes for authenticating user in cognito userpools. But I always get error saying "Error: Unable to verify secret hash for client 4b*******fd".

这里是代码:

AWS.config.region = 'us-east-1'; // Region
AWS.config.credentials = new AWS.CognitoIdentityCredentials({
    IdentityPoolId: 'us-east-1:b64bb629-ec73-4569-91eb-0d950f854f4f'
});

AWSCognito.config.region = 'us-east-1';
AWSCognito.config.credentials = new AWS.CognitoIdentityCredentials({
    IdentityPoolId: 'us-east-1:b6b629-er73-9969-91eb-0dfffff445d'
});

AWSCognito.config.update({accessKeyId: 'AKIAJNYLRONAKTKBXGMWA', secretAccessKey: 'PITHVAS5/UBADLU/dHITesd7ilsBCm'})

var poolData = {
    UserPoolId : 'us-east-1_l2arPB10',
    ClientId : '4bmsrr65ah3oas5d4sd54st11k'
};
var userPool = new AWSCognito.CognitoIdentityServiceProvider.CognitoUserPool(poolData);

var userData = {
     Username : '[email protected]',
     Pool : userPool
};

var cognitoUser = new AWSCognito.CognitoIdentityServiceProvider.CognitoUser(userData);

cognitoUser.confirmRegistration('123456', true,function(err, result) {
if (err) {
    alert(err);
    return;
}
console.log('call result: ' + result);
});


推荐答案

当前,AWS Cognito似乎无法处理客户端完美的秘密。

It seems that currently AWS Cognito doesn't handle client secret perfectly. It will work in the near future but as for now it is still a beta version.

对我来说,它对于没有客户端机密的应用程序运行正常,但对于

For me it is working fine for an app without a client secret but fails for an app with a client secret.

因此,在用户池中尝试创建一个新应用而不生成客户端秘密。然后使用该应用注册新用户或确认注册。

So in your user pool try to create a new app without generating a client secret. Then use that app to signup a new user or to confirm registration.

这篇关于无法在Amazon Cognito Userpools中验证客户端的秘密哈希的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 05:23