我正在使用Angular 4,并且在我从我的IdP收到SAML响应后尝试对给定用户进行身份验证,但AWS返回'400身份池ID未找到'错误。AWS Cognito,Angular,不识别身份池ID
我确认它是aws控制台显示的正确标识,并且所有内容都位于同一区域(us-west-2)。
下面是相关代码:
//Initialize
let cognitoIdentity = new AWS.CognitoIdentity({apiVersion: 'latest', region: environment.cognitoRegion});
cognitoIdentity.config.credentials = new AWSCognito.CognitoIdentityCredentials({IdentityPoolId: environment.identityPoolId});
cognitoIdentity.config.update({accessKeyId: 'anything', secretAccessKey: 'anything'})
//Setup params for authentication
var params = {
IdentityId: environment.identityPoolId,
Logins: {
[environment.SAMLProviderARN]: '<super long base64 saml response>'
}
};
//Get credentials for user
cognitoIdentity.getCredentialsForIdentity(params, function(err, data) {
//log error or sucessful response
if (err){
console.log(err, err.stack); // an error occurred
}
else {
console.log(data); // successful response
}
});
identityPoolId: 'us-west-2:52xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxd0'
cognitoRegion: 'us-west-2'
SAMLProviderARN: arn:aws:iam::(accountID):saml-provider/secpov-shibboleth
但我仍然得到400 “ResourceNotFoundException:身份 '美西2:52 ...... D0'。找不到”
你能分享你的'环境'变量吗?我可以检查Cognito数据存储以查看池的外观。 –
已更新w/info – canada11