无法在 Amazon Cognito 用户池中验证客户端的秘密哈希 [英] Unable to verify secret hash for client in Amazon Cognito Userpools

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

问题描述

我被困在Amazon Cognito Identity 用户池"过程中.

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 : 'ronakpatel@gmail.com',
     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 用户池中验证客户端的秘密哈希的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆