-
When I use the aws s3 client of javascript, I can use the following code to create the s3 client import { S3 } from "@aws-sdk/client-s3";
import { fromCognitoIdentityPool } from "@aws-sdk/credential-provider-cognito-identity";
import { CognitoIdentityClient } from "@aws-sdk/client-cognito-identity";
const s3Client = new S3({
region: 'region',
credentials: fromCognitoIdentityPool({
client: new CognitoIdentityClient({ region: 'region' }),
identityPoolId: 'identityPoolId',
})
}); Now I want to replace the golang sdk. In v1/v2, there is no similar authentication method. How should I do it? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
There is no convenience baked into Go v1/v2 for retrieving credentials from Cognito. You could use the cognitoidentity service client to implement a custom credential provider though and get the same behavior. You would need to look at the JS implementation and then map that to the Cognito/Go API's (the main APIs appear to be GetId and GetCredentialsForIdentity). |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
There is no convenience baked into Go v1/v2 for retrieving credentials from Cognito. You could use the cognitoidentity service client to implement a custom credential provider though and get the same behavior. You would need to look at the JS implementation and then map that to the Cognito/Go API's (the main APIs appear to be GetId and GetCredentialsForIdentity).