Closed gemmerton closed 2 months ago
Hi @gemmerton ,
If you didn't know, all of the AWS SDKs are code generated from the API models of the various AWS services. The types the SDK generates are matching whatever the AWS service specifies in their API model (PascalCase AccessKeyId). The service team cannot change the casing of the response they return since it would be considered a breaking change.
The solution here is to reconstruct the credential object yourself. something like this:
const credentials = {
accessKeyId: cognitoResponse.Credentials.AccessKeyId,
secretAccessKey: cognitoResponse.Credentials.SecretAccessKey,
sessionToken: cognitoResponse.Credentials.SessionToken
}
Thanks, Ran~
This issue has not received a response in 1 week. If you still think there is a problem, please leave a comment to avoid the issue from automatically closing.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.
Checkboxes for prior research
Describe the bug
When using
GetCredentialsForIdentityCommand
the response returnsAccessKeyId
,SecretKey
andSessionToken
. However, other AWS services to which these credentials need to be passed are expecting the formataccessKeyId
,secretAccessKey
andsessionToken
.So the response from the Cognito call needs to have the case changed in order to be useful for calls to other AWS services.
SDK version number
@aws-sdk/package-name@version, ...
Which JavaScript Runtime is this issue in?
Browser
Details of the browser/Node.js/ReactNative version
Chrome vers 123.0.6312.106
Reproduction Steps
Standard response from a
GetCredentialsForIdentityCommand
Observed Behavior
As per description, response is incorrect case/format for use with other AWS services
Expected Behavior
response should contain
accessKeyId
,secretAccessKey
andsessionToken
Possible Solution
No response
Additional Information/Context
No response