From 9726593d76c96a7341a8ae4f111ed25bc1ec2557 Mon Sep 17 00:00:00 2001 From: stephenbawks Date: Sat, 17 Jun 2023 07:55:20 -0400 Subject: [PATCH] fixing token --- aws_lambda_powertools/utilities/iam/aws_auth.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/aws_lambda_powertools/utilities/iam/aws_auth.py b/aws_lambda_powertools/utilities/iam/aws_auth.py index 31b0c88b582..985a702f770 100644 --- a/aws_lambda_powertools/utilities/iam/aws_auth.py +++ b/aws_lambda_powertools/utilities/iam/aws_auth.py @@ -38,8 +38,8 @@ def __init__( headers: Optional[str], access_key: Optional[str], secret_key: Optional[str], - token: Optional[str], region: Optional[str], + token: Optional[str] = None, sign_payload: Optional[bool] = False, ): @@ -55,12 +55,14 @@ def __init__( else: self._region = region - if access_key and secret_key or token: + if access_key and secret_key: self._access_key = access_key self._secret_key = secret_key - self._credentials = Credentials(access_key=self._access_key, secret_key=self._secret_key, token=token) + self._token = token + self._credentials = Credentials(access_key=self._access_key, secret_key=self._secret_key, token=self._token) else: - self._credentials = botocore.session.Session().get_credentials() + credentials = botocore.session.Session().get_credentials() + self._credentials = credentials.get_frozen_credentials() def __call__(self): request = AWSRequest(method=self._method, url=self._url, data=self._data, params=self._params, headers=self._headers)