Skip to content

aws sso login should respect credential expiration #6948

Description

@benkehoe

Describe the feature

Currently, aws sso login goes through the log in process whenever it's called. So if I have two profiles foo and bar that share the same AWS SSO configuration (i.e., sso_start_url and sso_region), when I call aws sso login --profile foo, it will pop up a browser window, log me in, etc., resulting in a valid token being cached in ~/.aws/sso/cache. If I then call aws sso login --profile bar (or aws sso login --profile foo again, for that matter), despite having a valid token for that config, it will go through the entire login process again, resulting in a new token.

Use Case

It's unnecessary work, and it's exacerbated by the argument to aws sso login being --profile, which leads people to think they need to call it whenever they're using a particular profile (I wrote an explainer to help people understand they don't need to do that).

Proposed Solution

aws sso login should check the expiration of the cached token, and exit out successfully if the token is not expired. There should be a --force-refresh option to override this.

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CLI version used

N/A

Environment details (OS name and version, etc.)

N/A

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Ready (External)

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions