Support programmatic AWS SSO authentication in botocore v1 without AWS CLI v2
See original GitHub issue~I’m looking forward to the AWS CLI v2 allowing aws login
to connect with AWS SSO. I’m also excited that the auth token retrieved by the CLI is managed by botocore, because it means scripts using the boto3 SDK can be run with the identity from aws login
. However, it would be great if scripts could manage their auth directly without involving the CLI.~
With botocore 1.17, support for loading credentials cached by aws sso login
has been added. This still means that Python applications cannot initiate AWS SSO auth, requiring their users to also install and understand the AWS CLI.
I’m asking for three things:
- Make the
SSOTokenFetcher.on_pending_auth
hook a provider-based system like the one for credentials. - Move the browser provider from the CLI into botocore, so a script using boto3 can use browser-based authentication (I guess I would also want a provider that only ever did the “print url+code instructions” too)
- Add a process provider like credentials have, so that users can implement alternative auth schemes against their IdP (for example, a browserless flow on headless systems like EC2 instances).
Issue Analytics
- State:
- Created 4 years ago
- Reactions:13
- Comments:12 (3 by maintainers)
Top Results From Across the Web
Configuring the AWS CLI to use AWS IAM Identity Center ...
This topic describes how to configure the AWS CLI to authenticate users with AWS IAM Identity Center (successor to AWS Single Sign-On) (IAM...
Read more >How to use the AWS Python SDK while connecting via SSO ...
and I see that it reads your credentials from ~/.aws/credentials (on a Linux machine). I however and not connecting with an IAM user...
Read more >SSOOIDC — Boto3 Docs 1.17.37 documentation - Amazon AWS
This API reference guide describes the AWS SSO OIDC operations that you can call programatically and includes detailed information on data types and...
Read more >You only need to call`aws sso login` once for all your profiles
The browser prompts you to grant credentials to the CLI, and when you click OK, the aws sso login command receives an SSO...
Read more >AWS Credentials - Serverless Framework
Enable Programmatic access by clicking the checkbox. Click Next to go through to the Permissions page. Click on Attach existing policies directly. Search...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@0xW1sKy I have written
aws-sso-lib
for programmatic AWS SSO functionality, andaws-sso-util
for things like generating profiles for all AWS SSO account+roles. Your script looks like it writes to~/.aws/credentials
as well, which I haveaws-export-credentials
for (that works with all kinds of AWS credentials)Following up on this now that the provider has been back ported into botocore v1.
For now, we have no immediate plans to expose the interfaces to programmatically resolve SSO credentials and store them in the shared caching location beyond the credential provider. There’s a few reasons we’ve decided to keep these private and here are some of the highlights:
Realistically, only one process needs to refresh the underlying SSO login session to ensure the credential provider can exchange for credentials using the shared cached session token. That being said, I definitely agree that there are improvements to be made on the current workflow. Ideally, in my mind this would be some kind of daemon that monitors login sessions and can notify the user when their credentials may be close to expiration to refresh the login session (e.g. via notifications, the task/menu bar, etc).
As a question, is there anything specifically about using the CLI v2 to perform the SSO login that’s a hard blocker?