granted sso login does not respect ExportSSOToken = true
#968
Replies: 2 comments 1 reply
Verbose logs
|
|
Confirmed from the source — the setting is only ever read in one place, and it isn't the login path. if assumeFlags.Bool("export-sso-token") || cfg.ExportSSOToken {
err := cfaws.ExportAccessTokenToCache(c.Context, profile)
...
clio.Success("Exported sso token to ~/.aws/sso/cache")
}Nothing in Worth flagging one thing for whoever picks this up, because it isn't a case of calling the existing helper from one more place. func ExportAccessTokenToCache(ctx context.Context, profile *Profile) error {
secureSSOTokenStorage := securestorage.NewSecureSSOTokenStorage()
// Find the access token for the SSOStartURL and SSOSessionName
tokenKey := profile.SSOStartURL() + profile.AWSConfig.SSOSessionName
cachedToken := secureSSOTokenStorage.GetValidSSOToken(ctx, tokenKey)
ssoPlainTextOut := CreatePlainTextSSO(profile.AWSConfig, cachedToken)
err := ssoPlainTextOut.DumpToCacheDirectory()It needs a profile for both the token key and for That distinction is probably worth putting in the issue, since "just call In the meantime, |
Uh oh!
There was an error while loading. Please reload this page.
Summary
The
ExportSSOToken = trueconfig setting works correctly withassume, butgranted sso logindoes not export the SSO token to~/.aws/sso/cache/. This means tools that rely on the AWS CLI's plaintext token cache (Terraform, AWS SDKs, SSM Session Manager plugin, etc.) don't pick up the token after a standalonegranted sso login.Expected behavior
When
ExportSSOToken = trueis set in~/.granted/config, bothassumeandgranted sso loginshould write the SSO token to~/.aws/sso/cache/.Actual behavior
assume my-profilecorrectly exports the token:[✔] Exported sso token to ~/.aws/sso/cachegranted sso login --sso-start-url https://example.awsapps.com/start --sso-region eu-west-1stores the token only in the macOS keychain and does not write to~/.aws/sso/cache/Reproduction
ExportSSOToken = truein~/.granted/configgranted sso login --sso-start-url https://example.awsapps.com/start --sso-region eu-west-1~/.aws/sso/cache/- no new/updated access token file is presentassume my-profilefor a profile using the same start URL~/.aws/sso/cache/- token file is now presentAdditional observation: trailing slash mismatch
There's also a trailing slash inconsistency between the two commands:
granted sso loginstores the token in keychain under accounthttps://example.awsapps.com/start(no trailing slash)assumelooks up the token underhttps://example.awsapps.com/start/(with trailing slash)This means a
granted sso loginsession is not found by a subsequentassume, forcing a re-authentication even though a valid token exists in the keychain.Environment
Config (
~/.granted/config)AWS profile (
~/.aws/config)All reactions