From d503d2877574f1ef8f707f995208d82b8362f9f1 Mon Sep 17 00:00:00 2001 From: Daniel Hougaard Date: Mon, 23 Sep 2024 23:37:20 +0400 Subject: [PATCH] Update util.ts --- src/custom/util.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/custom/util.ts b/src/custom/util.ts index 8dd2a14..0c2dd7a 100644 --- a/src/custom/util.ts +++ b/src/custom/util.ts @@ -34,6 +34,10 @@ export const getAwsRegion = async () => { export const performAwsIamLogin = async (baseUrl: string, identityId: string, region: string) => { const body = "Action=GetCallerIdentity&Version=2011-06-15"; + AWS.config.update({ + region + }); + const creds = await new Promise<{ sessionToken?: string; accessKeyId: string; secretAccessKey: string }>((resolve, reject) => { AWS.config.getCredentials((err, res) => { if (err) { @@ -47,10 +51,6 @@ export const performAwsIamLogin = async (baseUrl: string, identityId: string, re }); }); - AWS.config.update({ - region - }); - console.log("creds", creds); const signOpts = aws4.sign( @@ -61,7 +61,8 @@ export const performAwsIamLogin = async (baseUrl: string, identityId: string, re }, { accessKeyId: creds.accessKeyId, - secretAccessKey: creds.secretAccessKey + secretAccessKey: creds.secretAccessKey, + sessionToken: creds.sessionToken } );