Я пытаюсь получить доступ к s3 через логины Cognito.
Вот как я настраиваю AWS:
AWS.config.update({
region: 'us-west-2',
userPoolId: "us-west-2*******1",
userPoolWebClientId: "2******************n",
credentials: new AWS.CognitoIdentityCredentials({
IdentityPoolId: 'us-west-2:9**********2',
Logins: {
'cognito-idp.us-west-2.amazonaws.com/us-west-2*****1': idToken
}
})
});
Я получил следующую ошибку:
Error uploading data: { CredentialsError: Missing credentials in config
at Request.extractError (/Users/lushali/code/nexus/scripts/node_modules/aws-sdk/lib/protocol/json.js:51:27)
at Request.callListeners (/Users/lushali/code/nexus/scripts/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
at Request.emit (/Users/lushali/code/nexus/scripts/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
at Request.emit (/Users/lushali/code/nexus/scripts/node_modules/aws-sdk/lib/request.js:683:14)
at Request.transition (/Users/lushali/code/nexus/scripts/node_modules/aws-sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (/Users/lushali/code/nexus/scripts/node_modules/aws-sdk/lib/state_machine.js:14:12)
at /Users/lushali/code/nexus/scripts/node_modules/aws-sdk/lib/state_machine.js:26:10
at Request.<anonymous> (/Users/lushali/code/nexus/scripts/node_modules/aws-sdk/lib/request.js:38:9)
at Request.<anonymous> (/Users/lushali/code/nexus/scripts/node_modules/aws-sdk/lib/request.js:685:12)
at Request.callListeners (/Users/lushali/code/nexus/scripts/node_modules/aws-sdk/lib/sequential_executor.js:116:18)
message: 'Missing credentials in config',
code: 'CredentialsError',
time: 2019-03-14T17:22:59.631Z,
requestId: 'd08fc55f-467d-11e9-8560-a1dcaac0f3ba',
statusCode: 400,
retryable: false,
retryDelay: 72.65189640190827,
originalError:
{ message: 'Could not load credentials from CognitoIdentityCredentials',
code: 'CredentialsError',
time: 2019-03-14T17:22:59.631Z,
requestId: 'd08fc55f-467d-11e9-8560-a1dcaac0f3ba',
statusCode: 400,
retryable: false,
retryDelay: 72.65189640190827,
originalError:
{ message:
'Invalid identity pool configuration. Check assigned IAM roles for this pool.',
code: 'InvalidIdentityPoolConfigurationException',
time: 2019-03-14T17:22:59.629Z,
requestId: 'd08fc55f-467d-11e9-8560-a1dcaac0f3ba',
statusCode: 400,
retryable: false,
retryDelay: 72.65189640190827 } } }
Я искал вышеуказанную ошибку в Интернете и получил несколько предложений, таких как проверка доверительных отношений. [ AWS: неверная конфигурация пула удостоверений. Проверьте назначенные роли IAM для этого пула ]
Вот что у меня сейчас:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Federated": "cognito-identity.amazonaws.com"
},
"Action": "sts:AssumeRoleWithWebIdentity",
"Condition": {
"ForAnyValue:StringLike": {
"cognito-identity.amazonaws.com:amr": "authenticated",
"cognito-identity.amazonaws.com:aud": "us-west-2:9******2"
}
}
}
]
}
Это все еще проблема доверительных отношений? Пожалуйста, помогите, спасибо!