-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[V2] --access-token should be optional to sso calls #5057
Comments
Hi @mattwillsher , |
Yes @KaibaLopez I have the following as a workaround in my shell at the moment:
Having a more direct method of getting the access token would help reduce the complexity here. Being able to tell people to just call |
I was just looking for |
This is related to #5261. |
Just a note that I recently ran into this, and this thread was helpful (thank you @mattwillsher). We have hundreds of AWS accounts, and we're just now adopting AWS SSO. Many of us use If requiring the access token is required, it would be awesome if you could ask the AWS CLI for just the token cached to disk and a way to read back the value. The instructions I ended up writing for my devs includes asking them to type |
Came across this today and am confused as to why access token is needed. I create my session based on a profile name, then create the client from that session.
The session already has the access token so why do I need to provide it to the list-accounts method? There is no nice way of getting this token either apart from reading it from the ~/.aws/sso/cache file which feels fundamentally wrong. Or am I missing something? |
Here is a workaround to get to the JSON cache file until this issue is fixed: For AWS cli > 2.13.5 the name of the cache file is the sha1sum of your sso session name in the profile. local sso_session=$(aws configure get sso_session --profile "${profile}")
local cache_file="${HOME}/.aws/sso/cache/$(echo -n "${sso_session}" | sha1sum | awk '{print $1}').json"
local access_token=$( jq --raw-output .accessToken "${cache_file}")
|
Do you know what it uses when the sso_session property for the given profile does not exist? In my case this property is not set in the profile configuration in the config file. Do you have any documentation that i can refer to? |
i worked it out. If you are using the old legacy format for your SSO config file then the file is the hash of the sso_start_url, if you are using the new format then it is the sso_session. See example code in python:
|
I want to aws test-access --profile {profilename} so I can exit script. devs are logged in with SSO and CI/CD is logged in with machine tokens but all use profile to match. is there a way (it seemed so related to this is all). |
I wrote a script to configure all AWS IAM Identity Center (SSO) accounts and roles automatically. It requires AWS CLI v2 and jq. Download the |
aws sso login creates a cache files in ~/.aws/sso/cache which contains an access token
aws sso list-accounts and list-account-roles requires an access-token.
It would be helpful to have a mechanise to either output the current valid access token or make the argument optional and use the cached value for the current context.
The text was updated successfully, but these errors were encountered: