I'm trying to establish a boto3
session with boto3.session.Session(profile_name='foo')
but getting an UnauthorizedSSOTokenError
error:
botocore.exceptions.UnauthorizedSSOTokenError: The SSO session associated with this profile has expired or is otherwise invalid. To refresh this SSO session run aws sso login with the corresponding profile.
I tried logging in with subprocess.run("aws sso login --profile foo")
, but this opens up my web browser and prompts for manual confirmation.
Is there any way to programmatically establish boto3
sessions if you're using AWS SSO?
In other words, is there any way to avoid manual confirmation?