Skip to content

Commit 0399a78

Browse files
stephenbawksrubenfonseca
authored andcommitted
fixing token
1 parent 8ba92d9 commit 0399a78

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

aws_lambda_powertools/utilities/iam/aws_auth.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ def __init__(
3838
headers: Optional[str],
3939
access_key: Optional[str],
4040
secret_key: Optional[str],
41-
token: Optional[str],
4241
region: Optional[str],
42+
token: Optional[str] = None,
4343
sign_payload: Optional[bool] = False,
4444
):
4545

@@ -55,12 +55,14 @@ def __init__(
5555
else:
5656
self._region = region
5757

58-
if access_key and secret_key or token:
58+
if access_key and secret_key:
5959
self._access_key = access_key
6060
self._secret_key = secret_key
61-
self._credentials = Credentials(access_key=self._access_key, secret_key=self._secret_key, token=token)
61+
self._token = token
62+
self._credentials = Credentials(access_key=self._access_key, secret_key=self._secret_key, token=self._token)
6263
else:
63-
self._credentials = botocore.session.Session().get_credentials()
64+
credentials = botocore.session.Session().get_credentials()
65+
self._credentials = credentials.get_frozen_credentials()
6466

6567
def __call__(self):
6668
request = AWSRequest(method=self._method, url=self._url, data=self._data, params=self._params, headers=self._headers)

0 commit comments

Comments
 (0)