我无法将JS中用于通过Cognito Identity进行身份验证的工作代码转换为C#中的工作代码
现在,使用javascript lanaguage的过程已经到位,并且可以正常工作,如下所示:
标题
{
"kid":"eu-west-11",
"typ":"JWS",
"alg":"RS512"
}
有效载荷
{
"sub":"eu-west-1:eed436ce-0126-494e-a098-647XXXXXXXXX",
"aud":"eu-west-1:1e71e5a8-2554-4a92-9f22-ca1XXXXXXXXX",
"amr":[
"authenticated",
"auth.cognito.custom.gsdp.fca",
"auth.cognito.custom.gsdp.fca:eu-west-1:1e71e5a8-2554-4a92-9f22-ca1fcca153e2:a097fc344410484e827XXXXXXXXXX"
],
"iss":"https://cognito-identity.amazonaws.com",
"exp":1561629216,
"iat":1561628916
}
签名
XXXXXXXXXX
var iss = decodedToken.payload.iss.split('//')[1]; //iis obtained in the previous step
var logins = {};
logins[iss] = token; //(Token obtained by the lambda function on the previous point)
AWS.config.region = cognito_sdpr_params.region; // Region
AWS.config.credentials = new AWS.CognitoIdentityCredentials({
IdentityId: identityId, //(identityId Obtained by the lambda function on the previous point)
Logins: logins
});
AWS.config.credentials.get(function () {
$timeout(function () {...})})
var iss = decodedToken.payload.iss.split('//')[1]; //iis obtained in the previous step
var logins = {};
logins[iss] = token; //(Token obtained by the lambda function on the previous point)
AWS.config.region = cognito_sdpr_params.region; // Region
AWS.config.credentials = new AWS.CognitoIdentityCredentials({
IdentityId: identityId, //(identityId Obtained by the lambda function on the previous point)
Logins: logins
});
AWS.config.credentials.get(function () {
$timeout(function () {...})})
好的,所有这些都可以在javascript上正常工作,但是现在需要在Web服务中的.net中复制相同的过程。
我到达复制相同的过程,直到第3点(不包括在内),但是我无法获得凭据,而且我不知道该怎么做。 我的意思是我尝试使用例如以下代码:
但是我收到类似以下错误:“此身份池不支持未经身份验证的访问。” 我不明白此消息,因为所有内容都适用于javascript,而不适用于.net以及Lambda si获得的令牌,该令牌将用户验证为已通过身份验证,如上所述。
感谢任何帮助,非常感谢 最好的问候