* Which Category is your question related to? *
Authorisation - AWS Cognito via Amplify
* What AWS Services are you utilizing? *
AWS Amplify, Auth, Cognito
* Provide additional details e.g. code snippets *
I would like to know what the equivalent function is in Amplify using Auth in order to retrieve the following values:
// Make the call to obtain credentials
AWS.config.credentials.get(function(){
// Credentials will be available when this function is called.
var accessKeyId = AWS.config.credentials.accessKeyId;
var secretAccessKey = AWS.config.credentials.secretAccessKey;
var sessionToken = AWS.config.credentials.sessionToken;
});
I have looked at the results of Auth.currentSession and Auth.currentAuthenticatedUser and can see the following:
idToken.jwtToken
accessToken.jwtToken
refreshToken.token
Are these the correct values? Reason for asking is that I need to run SigV4Utils against one of my URLs using those values to create a signed URL.
Any help much appreciated!
Hi @kirkryan thanks for your question.
For AWS credentials you can get it by using Auth.currentCredentials() like this
Auth.currentCredentials()
.then(credentials => {
const awsCreds = Auth.essentialCredentials(credentials);
//...
});
Most helpful comment
Hi @kirkryan thanks for your question.
For AWS credentials you can get it by using
Auth.currentCredentials()like this