Skip to content

Commit

Permalink
fixing token
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenbawks committed Jun 17, 2023
1 parent ed40d52 commit 9726593
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions aws_lambda_powertools/utilities/iam/aws_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
):

Expand All @@ -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)
Expand Down

0 comments on commit 9726593

Please sign in to comment.