I have a role in another which has the condition
"Condition": {
"StringEquals": {
"sts:ExternalId": "12345"
}
}
I am using the following session to assume it
def assumed_role_session(role_arn):
base_session = boto3.session.Session()._session
fetcher = botocore.credentials.AssumeRoleCredentialFetcher(
client_creator = base_session.create_client,
source_credentials = base_session.get_credentials(),
role_arn = role_arn,
)
creds = botocore.credentials.DeferredRefreshableCredentials(
method = 'assume-role',
refresh_using = fetcher.fetch_credentials,
time_fetcher = lambda: datetime.datetime.now(tzlocal())
)
botocore_session = botocore.session.Session()
botocore_session._credentials = creds
return boto3.Session(botocore_session = botocore_session)
But it is giving authorization issues. Can anyone help with where the external id has to be put?