Repository navigation
Closed
Labels
Description
Describe the bug
https://docs.aws.amazon.com/cli/latest/userguide/sso-configure-profile-token.html
~/.aws/config
[profile hc-dev-sso]
sso_session = sso
sso_start_url = https://mycompany.awsapps.com/start
sso_region = eu-west-1
sso_account_id = 12345567789
sso_role_name = AWSAdministratorAccess
[sso-session sso]
sso_region = eu-west-1
sso_start_url = https://mycompany.awsapps.com/start
sso_registration_scope = sso:account:access
aws s3 ls --debug
2023-02-10 07:11:27,531 - MainThread - awscli.clidriver - DEBUG - CLI version: aws-cli/2.9.22 Python/3.9.11 Darwin/21.6.0 exe/x86_64
2023-02-10 07:11:27,531 - MainThread - awscli.clidriver - DEBUG - Arguments entered to CLI: ['s3', 'ls', '--debug']
2023-02-10 07:11:27,542 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <function add_s3 at 0x7f802984f940>
2023-02-10 07:11:27,542 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <function add_ddb at 0x7f80296a40d0>
2023-02-10 07:11:27,542 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <bound method BasicCommand.add_command of <class 'awscli.customizations.configure.configure.ConfigureCommand'>>
2023-02-10 07:11:27,542 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <function change_name at 0x7f802962be50>
2023-02-10 07:11:27,542 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <function change_name at 0x7f8029636e50>
2023-02-10 07:11:27,542 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <function alias_opsworks_cm at 0x7f8029861310>
2023-02-10 07:11:27,542 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <function add_history_commands at 0x7f80296ebc10>
2023-02-10 07:11:27,542 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <bound method BasicCommand.add_command of <class 'awscli.customizations.devcommands.CLIDevCommand'>>
2023-02-10 07:11:27,542 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <function add_waiters at 0x7f802985a550>
2023-02-10 07:11:27,543 - MainThread - botocore.hooks - DEBUG - Event building-command-table.main: calling handler <bound method AliasSubCommandInjector.on_building_command_table of <awscli.alias.AliasSubCommandInjector object at 0x7f80298e5e20>>
2023-02-10 07:11:27,543 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /usr/local/aws-cli/awscli/data/cli.json
2023-02-10 07:11:27,544 - MainThread - botocore.hooks - DEBUG - Event top-level-args-parsed: calling handler <function resolve_types at 0x7f80297a5670>
2023-02-10 07:11:27,544 - MainThread - botocore.hooks - DEBUG - Event top-level-args-parsed: calling handler <function no_sign_request at 0x7f80297a71f0>
2023-02-10 07:11:27,544 - MainThread - botocore.hooks - DEBUG - Event top-level-args-parsed: calling handler <function resolve_verify_ssl at 0x7f80297a7160>
2023-02-10 07:11:27,544 - MainThread - botocore.hooks - DEBUG - Event top-level-args-parsed: calling handler <function resolve_cli_read_timeout at 0x7f80297a7310>
2023-02-10 07:11:27,544 - MainThread - botocore.hooks - DEBUG - Event top-level-args-parsed: calling handler <function resolve_cli_connect_timeout at 0x7f80297a7280>
2023-02-10 07:11:27,544 - MainThread - botocore.hooks - DEBUG - Event top-level-args-parsed: calling handler <built-in method update of dict object at 0x7f80298fc140>
2023-02-10 07:11:27,544 - MainThread - awscli.clidriver - DEBUG - CLI version: aws-cli/2.9.22 Python/3.9.11 Darwin/21.6.0 exe/x86_64 prompt/off
2023-02-10 07:11:27,544 - MainThread - awscli.clidriver - DEBUG - Arguments entered to CLI: ['s3', 'ls', '--debug']
2023-02-10 07:11:27,544 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function add_timestamp_parser at 0x7f802984ff70>
2023-02-10 07:11:27,544 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function register_uri_param_handler at 0x7f80293b2280>
2023-02-10 07:11:27,545 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function add_binary_formatter at 0x7f80298c0430>
2023-02-10 07:11:27,545 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function no_pager_handler at 0x7f80293a8550>
2023-02-10 07:11:27,545 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function inject_assume_role_provider_cache at 0x7f8029429e50>
2023-02-10 07:11:27,546 - MainThread - botocore.utils - DEBUG - IMDS ENDPOINT: http://169.254.169.254/
2023-02-10 07:11:27,552 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function attach_history_handler at 0x7f80296ebaf0>
2023-02-10 07:11:27,552 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function inject_json_file_cache at 0x7f8029693e50>
2023-02-10 07:11:27,552 - MainThread - botocore.hooks - DEBUG - Event building-command-table.s3: calling handler <function add_waiters at 0x7f802985a550>
2023-02-10 07:11:27,552 - MainThread - botocore.hooks - DEBUG - Event building-command-table.s3: calling handler <bound method AliasSubCommandInjector.on_building_command_table of <awscli.alias.AliasSubCommandInjector object at 0x7f80298e5e20>>
2023-02-10 07:11:27,552 - MainThread - botocore.hooks - DEBUG - Event building-command-table.s3_ls: calling handler <function add_waiters at 0x7f802985a550>
2023-02-10 07:11:27,552 - MainThread - botocore.hooks - DEBUG - Event building-command-table.s3_ls: calling handler <bound method AliasSubCommandInjector.on_building_command_table of <awscli.alias.AliasSubCommandInjector object at 0x7f80298e5e20>>
2023-02-10 07:11:27,553 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.custom.ls.paths: calling handler <awscli.paramfile.URIArgumentHandler object at 0x7f8038316820>
2023-02-10 07:11:27,553 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.custom.ls.anonymous: calling handler <awscli.paramfile.URIArgumentHandler object at 0x7f8038316820>
2023-02-10 07:11:27,553 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.custom.ls.page-size: calling handler <awscli.paramfile.URIArgumentHandler object at 0x7f8038316820>
2023-02-10 07:11:27,553 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.custom.ls.human-readable: calling handler <awscli.paramfile.URIArgumentHandler object at 0x7f8038316820>
2023-02-10 07:11:27,553 - MainThread - botocore.hooks - DEBUG - Event process-cli-arg.custom.ls: calling handler <awscli.argprocess.ParamShorthandParser object at 0x7f80293d49d0>
2023-02-10 07:11:27,553 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.custom.ls.summarize: calling handler <awscli.paramfile.URIArgumentHandler object at 0x7f8038316820>
2023-02-10 07:11:27,553 - MainThread - botocore.hooks - DEBUG - Event process-cli-arg.custom.ls: calling handler <awscli.argprocess.ParamShorthandParser object at 0x7f80293d49d0>
2023-02-10 07:11:27,553 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.custom.ls.request-payer: calling handler <awscli.paramfile.URIArgumentHandler object at 0x7f8038316820>
2023-02-10 07:11:27,553 - MainThread - botocore.utils - DEBUG - IMDS ENDPOINT: http://169.254.169.254/
2023-02-10 07:11:27,554 - MainThread - urllib3.connectionpool - DEBUG - Starting new HTTP connection (1): 169.254.169.254:80
2023-02-10 07:11:28,557 - MainThread - botocore.utils - DEBUG - Caught retryable HTTP exception while making metadata service request to http://169.254.169.254/latest/api/token: Connect timeout on endpoint URL: "http://169.254.169.254/latest/api/token"
Traceback (most recent call last):
File "urllib3/connection.py", line 174, in _new_conn
File "urllib3/util/connection.py", line 95, in create_connection
File "urllib3/util/connection.py", line 85, in create_connection
socket.timeout: timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "awscli/botocore/httpsession.py", line 448, in send
File "urllib3/connectionpool.py", line 787, in urlopen
File "urllib3/util/retry.py", line 525, in increment
File "urllib3/packages/six.py", line 770, in reraise
File "urllib3/connectionpool.py", line 703, in urlopen
File "urllib3/connectionpool.py", line 398, in _make_request
File "urllib3/connection.py", line 239, in request
File "http/client.py", line 1285, in request
File "awscli/botocore/awsrequest.py", line 94, in _send_request
File "http/client.py", line 1331, in _send_request
File "http/client.py", line 1280, in endheaders
File "awscli/botocore/awsrequest.py", line 122, in _send_output
File "awscli/botocore/awsrequest.py", line 206, in send
File "http/client.py", line 980, in send
File "urllib3/connection.py", line 205, in connect
File "urllib3/connection.py", line 179, in _new_conn
urllib3.exceptions.ConnectTimeoutError: (<botocore.awsrequest.AWSHTTPConnection object at 0x7f800800c160>, 'Connection to 169.254.169.254 timed out. (connect timeout=1)')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "awscli/botocore/utils.py", line 383, in _fetch_metadata_token
File "awscli/botocore/httpsession.py", line 483, in send
botocore.exceptions.ConnectTimeoutError: Connect timeout on endpoint URL: "http://169.254.169.254/latest/api/token"
2023-02-10 07:11:28,566 - MainThread - urllib3.connectionpool - DEBUG - Starting new HTTP connection (2): 169.254.169.254:80
2023-02-10 07:11:29,568 - MainThread - botocore.utils - DEBUG - Caught retryable HTTP exception while making metadata service request to http://169.254.169.254/latest/meta-data/placement/availability-zone/: Connect timeout on endpoint URL: "http://169.254.169.254/latest/meta-data/placement/availability-zone/"
Traceback (most recent call last):
File "urllib3/connection.py", line 174, in _new_conn
File "urllib3/util/connection.py", line 95, in create_connection
File "urllib3/util/connection.py", line 85, in create_connection
socket.timeout: timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "awscli/botocore/httpsession.py", line 448, in send
File "urllib3/connectionpool.py", line 787, in urlopen
File "urllib3/util/retry.py", line 525, in increment
File "urllib3/packages/six.py", line 770, in reraise
File "urllib3/connectionpool.py", line 703, in urlopen
File "urllib3/connectionpool.py", line 398, in _make_request
File "urllib3/connection.py", line 239, in request
File "http/client.py", line 1285, in request
File "awscli/botocore/awsrequest.py", line 94, in _send_request
File "http/client.py", line 1331, in _send_request
File "http/client.py", line 1280, in endheaders
File "awscli/botocore/awsrequest.py", line 122, in _send_output
File "awscli/botocore/awsrequest.py", line 206, in send
File "http/client.py", line 980, in send
File "urllib3/connection.py", line 205, in connect
File "urllib3/connection.py", line 179, in _new_conn
urllib3.exceptions.ConnectTimeoutError: (<botocore.awsrequest.AWSHTTPConnection object at 0x7f8038316d60>, 'Connection to 169.254.169.254 timed out. (connect timeout=1)')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "awscli/botocore/utils.py", line 431, in _get_request
File "awscli/botocore/httpsession.py", line 483, in send
botocore.exceptions.ConnectTimeoutError: Connect timeout on endpoint URL: "http://169.254.169.254/latest/meta-data/placement/availability-zone/"
2023-02-10 07:11:29,571 - MainThread - awscli.utils - DEBUG - Max number of attempts exceeded (1) when attempting to retrieve data from metadata service.
2023-02-10 07:11:29,571 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: env
2023-02-10 07:11:29,571 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: assume-role
2023-02-10 07:11:29,571 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: assume-role-with-web-identity
2023-02-10 07:11:29,572 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: sso
2023-02-10 07:11:29,573 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /usr/local/aws-cli/awscli/botocore/data/endpoints.json
2023-02-10 07:11:29,586 - MainThread - botocore.hooks - DEBUG - Event choose-service-name: calling handler <function handle_service_name_alias at 0x7f8028aa1160>
2023-02-10 07:11:29,600 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /usr/local/aws-cli/awscli/botocore/data/s3/2006-03-01/service-2.json
2023-02-10 07:11:29,619 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /usr/local/aws-cli/awscli/botocore/data/s3/2006-03-01/endpoint-rule-set-1.json
2023-02-10 07:11:29,624 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /usr/local/aws-cli/awscli/botocore/data/partitions.json
2023-02-10 07:11:29,626 - MainThread - botocore.hooks - DEBUG - Event creating-client-class.s3: calling handler <function add_generate_presigned_post at 0x7f80289f4c10>
2023-02-10 07:11:29,626 - MainThread - botocore.hooks - DEBUG - Event creating-client-class.s3: calling handler <function add_generate_presigned_url at 0x7f80289f49d0>
2023-02-10 07:11:29,628 - MainThread - botocore.endpoint - DEBUG - Setting s3 timeout as (60, 60)
2023-02-10 07:11:29,630 - MainThread - botocore.utils - DEBUG - Registering S3 region redirector handler
2023-02-10 07:11:29,630 - MainThread - botocore.hooks - DEBUG - Event before-endpoint-resolution.s3: calling handler <function customize_endpoint_resolver_builtins at 0x7f8028ac01f0>
2023-02-10 07:11:29,630 - MainThread - botocore.hooks - DEBUG - Event before-endpoint-resolution.s3: calling handler <bound method S3RegionRedirectorv2.redirect_from_cache of <botocore.utils.S3RegionRedirectorv2 object at 0x7f80299c0130>>
2023-02-10 07:11:29,630 - MainThread - botocore.regions - DEBUG - Calling endpoint provider with parameters: {'Region': 'aws-global', 'UseFIPS': False, 'UseDualStack': False, 'ForcePathStyle': False, 'Accelerate': False, 'UseGlobalEndpoint': False, 'DisableMultiRegionAccessPoints': False, 'UseArnRegion': True}
2023-02-10 07:11:29,631 - MainThread - botocore.regions - DEBUG - Endpoint provider result: https://s3.amazonaws.com
2023-02-10 07:11:29,631 - MainThread - botocore.regions - DEBUG - Selecting from endpoint provider's list of auth schemes: "sigv4". User selected auth scheme is: "None"
2023-02-10 07:11:29,631 - MainThread - botocore.regions - DEBUG - Selected auth type "v4" as "v4" with signing context params: {'region': 'us-east-1', 'signing_name': 's3', 'disableDoubleEncoding': True}
2023-02-10 07:11:29,631 - MainThread - botocore.hooks - DEBUG - Event provide-client-params.s3.ListBuckets: calling handler <function base64_decode_input_blobs at 0x7f80298c0b80>
2023-02-10 07:11:29,631 - MainThread - botocore.hooks - DEBUG - Event before-parameter-build.s3.ListBuckets: calling handler <function validate_bucket_name at 0x7f8028aba280>
2023-02-10 07:11:29,631 - MainThread - botocore.hooks - DEBUG - Event before-parameter-build.s3.ListBuckets: calling handler <function remove_bucket_from_url_paths_from_model at 0x7f8028ac0040>
2023-02-10 07:11:29,631 - MainThread - botocore.hooks - DEBUG - Event before-parameter-build.s3.ListBuckets: calling handler <bound method S3RegionRedirectorv2.annotate_request_context of <botocore.utils.S3RegionRedirectorv2 object at 0x7f80299c0130>>
2023-02-10 07:11:29,631 - MainThread - botocore.hooks - DEBUG - Event before-parameter-build.s3.ListBuckets: calling handler <function generate_idempotent_uuid at 0x7f8028aba0d0>
2023-02-10 07:11:29,631 - MainThread - botocore.hooks - DEBUG - Event before-call.s3.ListBuckets: calling handler <function add_expect_header at 0x7f8028aba5e0>
2023-02-10 07:11:29,631 - MainThread - botocore.hooks - DEBUG - Event before-call.s3.ListBuckets: calling handler <function inject_api_version_header_if_needed at 0x7f8028abc940>
2023-02-10 07:11:29,631 - MainThread - botocore.endpoint - DEBUG - Making request for OperationModel(name=ListBuckets) with params: {'url_path': '/', 'query_string': '', 'method': 'GET', 'headers': {'User-Agent': 'aws-cli/2.9.22 Python/3.9.11 Darwin/21.6.0 exe/x86_64 prompt/off command/s3.ls'}, 'body': b'', 'url': 'https://s3.amazonaws.com/', 'context': {'client_region': 'aws-global', 'client_config': <botocore.config.Config object at 0x7f8038397730>, 'has_streaming_input': False, 'auth_type': 'v4', 'signing': {'region': 'us-east-1', 'signing_name': 's3', 'disableDoubleEncoding': True}, 's3_redirect': {'redirected': False, 'bucket': None, 'params': {}}}}
2023-02-10 07:11:29,631 - MainThread - botocore.hooks - DEBUG - Event request-created.s3.ListBuckets: calling handler <bound method RequestSigner.handler of <botocore.signers.RequestSigner object at 0x7f8038397820>>
2023-02-10 07:11:29,631 - MainThread - botocore.hooks - DEBUG - Event choose-signer.s3.ListBuckets: calling handler <function set_operation_specific_signer at 0x7f8028ab7f70>
2023-02-10 07:11:29,631 - MainThread - botocore.hooks - DEBUG - Event before-sign.s3.ListBuckets: calling handler <function remove_arn_from_signing_path at 0x7f8028ac0160>
2023-02-10 07:11:29,632 - MainThread - botocore.credentials - DEBUG - Credentials were found in cache, but they are expired.
2023-02-10 07:11:29,633 - MainThread - botocore.hooks - DEBUG - Event choose-service-name: calling handler <function handle_service_name_alias at 0x7f8028aa1160>
2023-02-10 07:11:29,633 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /usr/local/aws-cli/awscli/botocore/data/sso/2019-06-10/service-2.json
2023-02-10 07:11:29,633 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /usr/local/aws-cli/awscli/botocore/data/sso/2019-06-10/endpoint-rule-set-1.json
2023-02-10 07:11:29,634 - MainThread - botocore.hooks - DEBUG - Event creating-client-class.sso: calling handler <function add_generate_presigned_url at 0x7f80289f49d0>
2023-02-10 07:11:29,635 - MainThread - botocore.endpoint - DEBUG - Setting portal.sso timeout as (60, 60)
2023-02-10 07:11:29,636 - MainThread - botocore.tokens - INFO - Loading cached SSO token for sso
2023-02-10 07:11:29,636 - MainThread - botocore.utils - DEBUG - Checking for cached token at: afb9d1dcf212fa33d079a070ab90f0bef03c324b
2023-02-10 07:11:29,636 - MainThread - botocore.tokens - DEBUG - Cached SSO token expires at 2023-02-09 14:06:31+00:00
2023-02-10 07:11:29,637 - MainThread - botocore.tokens - INFO - Unable to refresh SSO token: missing keys: ['refreshToken']
2023-02-10 07:11:29,637 - MainThread - botocore.credentials - WARNING - Refreshing temporary credentials failed during mandatory refresh period.
Traceback (most recent call last):
File "awscli/botocore/credentials.py", line 492, in _protected_refresh
File "awscli/botocore/credentials.py", line 633, in fetch_credentials
File "awscli/botocore/credentials.py", line 643, in _get_cached_credentials
File "awscli/botocore/credentials.py", line 2008, in _get_credentials
File "awscli/botocore/tokens.py", line 84, in get_frozen_token
File "awscli/botocore/tokens.py", line 97, in _refresh
File "awscli/botocore/tokens.py", line 124, in _protected_refresh
botocore.exceptions.TokenRetrievalError: Error when retrieving token from sso: Token has expired and refresh failed
2023-02-10 07:11:29,637 - MainThread - awscli.clidriver - DEBUG - Exception caught in main()
Traceback (most recent call last):
File "awscli/clidriver.py", line 460, in main
File "awscli/customizations/commands.py", line 151, in __call__
File "awscli/customizations/commands.py", line 205, in __call__
File "awscli/customizations/s3/subcommands.py", line 505, in _run_main
File "awscli/customizations/s3/subcommands.py", line 570, in _list_all_buckets
File "awscli/botocore/client.py", line 341, in _api_call
File "awscli/botocore/client.py", line 683, in _make_api_call
File "awscli/botocore/client.py", line 703, in _make_request
File "awscli/botocore/endpoint.py", line 101, in make_request
File "awscli/botocore/endpoint.py", line 131, in _send_request
File "awscli/botocore/endpoint.py", line 114, in create_request
File "awscli/botocore/hooks.py", line 228, in emit
File "awscli/botocore/hooks.py", line 211, in _emit
File "awscli/botocore/signers.py", line 94, in handler
File "awscli/botocore/signers.py", line 158, in sign
File "awscli/botocore/signers.py", line 253, in get_auth_instance
File "awscli/botocore/credentials.py", line 581, in get_frozen_credentials
File "awscli/botocore/credentials.py", line 476, in _refresh
File "awscli/botocore/credentials.py", line 492, in _protected_refresh
File "awscli/botocore/credentials.py", line 633, in fetch_credentials
File "awscli/botocore/credentials.py", line 643, in _get_cached_credentials
File "awscli/botocore/credentials.py", line 2008, in _get_credentials
File "awscli/botocore/tokens.py", line 84, in get_frozen_token
File "awscli/botocore/tokens.py", line 97, in _refresh
File "awscli/botocore/tokens.py", line 124, in _protected_refresh
botocore.exceptions.TokenRetrievalError: Error when retrieving token from sso: Token has expired and refresh failed
Expected Behavior
Token is refreshed.
Current Behavior
Exception is raised.
Reproduction Steps
See above
Possible Solution
No response
Additional Information/Context
Legacy path works: https://docs.aws.amazon.com/cli/latest/userguide/sso-configure-profile-legacy.html
aws sso login works too
aws sso login
Attempting to automatically open the SSO authorization page in your default browser.
If the browser does not open or you wish to use a different device to authorize this request, open the following URL:
https://device.sso.eu-west-1.amazonaws.com/
Then enter the code:
KZMJ-WVPD
Successfully logged into Start URL: https://mycompany.awsapps.com/start
after that a new token is generated and stored in
~/.aws/cli/cache
from now on all aws cli commands work
CLI version used
aws-cli/2.9.22 Python/3.9.11 Darwin/21.6.0 exe/x86_64 prompt/off
Environment details (OS name and version, etc.)
Darwin INV-18189.local 21.6.0 Darwin Kernel Version 21.6.0: Mon Aug 22 20:19:52 PDT 2022; root:xnu-8020.140.49~2/RELEASE_ARM64_T6000 arm64
Reacted by Georg Friedrich, György Balássy and Richard Höchenberger
Activity
lkoniecz commentedon Feb 10, 2023
https://docs.aws.amazon.com/singlesignon/latest/userguide/authconcept.html
IAM Identity Center application sessions have a refreshable 1-hour lifetime – that is, IAM Identity Center application sessions are automatically refreshed every hour as long as the IAM Identity Center sign in session from which they were obtained is still valid.
Am I reading this correctly that session is automatically refreshed within configurable duration as long as I am firing aws commands using that session? Lack of executions for at least configurable duration will invalidate the session?
example:
7:00 - sso login - receive 4h valid JWT
10:50 - fire some aws command - got 1 more hour
11:50 - session is invalidated
tim-finnigan commentedon Feb 14, 2023
Hi @lkoniecz thanks for reaching out. I'll share some links to the SSO (now Identity Center) user guide that may help:
For configuring access portal session duration please refer to this documentation: https://docs.aws.amazon.com/singlesignon/latest/userguide/configure-user-session.html.
For configuring permission set session duration you can refer to this documentation: https://docs.aws.amazon.com/singlesignon/latest/userguide/howtosessionduration.html.
Also in the AWS CLI documentation you referenced earlier, it notes:
I hope that helps — please let us know if you have any follow up questions. If there are any additional details you could share as far as how you configured SSO and what else you've attempted that could help with further investigation as well.
github-actions commentedon Feb 19, 2023
Greetings! It looks like this issue hasn’t been active in longer than five days. We encourage you to check if this is still an issue in the latest release. In the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or upvote with a reaction on the initial post to prevent automatic closure. If the issue is already closed, please feel free to open a new one.
GFriedrich commentedon Feb 19, 2023
@tim-finnigan: I was also just falling for this issue.
After I read the pages you've mentioned once again I found this important paragraph:
So if I get this right, it is impossible right now to extend the IAM Identity Center session. The question I have: Why is that? What is the reason that one is not able to extend the session by running a refresh and instead being required to fully re-authenticate. Isn't this the purpose of a refreshed refresh token in the first place? IMHO this is behaving rather unusual and I don't see any reason for why it was implemented this way.
Would be great if you could explain the reasoning from AWS point of view on this.
tim-finnigan commentedon Feb 21, 2023
To elaborate on the two sessions involved with Identity Center:
There is Identity Center itself which 8 hours by default but can now be configured. As long as this session is active, you can assume roles in accounts. Once it expires, you must re-authenticate.
Permission Set session duration, which is 1 hour by default and also configurable. As long as this session is active, you can issue commands in your active session. On the CLI, this will auto-refresh as long as the Identity Center session is active. In the browser, you have to click on the role again to refresh the session.
I hope that helps clarify the behavior.
6 remaining items
GFriedrich commentedon Mar 8, 2023
Hey @tim-finnigan and thanks for getting back.
I do understand that refreshing makes sense in connection with security concerns, but what doesn't make sense to me is that the refresh is limited and one has to fully reauthenticate after a certain period.
But anyways: I do understand that you can't do anything about it, so thanks for the link. I'll provide my feedback right there.
diranged commentedon Mar 10, 2023
So I have been digging through the exact same problems and confusion that the OP had, as well as @lkoniecz. I think my biggest question is around the
aws sso loginwhen refreshing tokens. Why does it require that the user re-approve the boto client each time? Shouldn't the refresh be a fairly seamless operation? Am I missing something?tim-finnigan commentedon Mar 14, 2023
Hi @diranged can you elaborate on what you mean by re-approving the boto client? Which part of the behavior/documentation referenced here is unexpected?
diranged commentedon Mar 16, 2023
I ultimately got this fixed .. the instructions at https://docs.aws.amazon.com/cli/latest/userguide/sso-configure-profile-token.html are so very similar to the instructions at https://docs.aws.amazon.com/cli/latest/userguide/sso-configure-profile-legacy.html that I followed the legacy instructions in our setup initially which caused us to have unrefreshable access tokens. The documentation is very confusing and it really doesn't call out the specific differences in the process and why those differences make sense.
tim-finnigan commentedon Mar 16, 2023
Thanks for following up — I'm glad you were able to fix the issue and sorry to hear that the documentation was confusing. As mentioned earlier in this issue, the "Provide feedback" links at the bottom of documentation pages are the best way to get in touch with the individuals who can improve the current wording.
github-actions commentedon Mar 16, 2023
Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.
msvechla commentedon May 11, 2023
How did you get this fixed? I still have to click "Allow" every time I do
aws sso loginrohit901 commentedon Mar 1, 2024
Hello, thank you for the clarifications. I'm new to AWS, and just wanted to clarify.
To ensure our tokens auto-refresh for a longer period, we have to follow step 1 above and just increase identity center session duration right?
As long as default of identity center is increased from 8 hours, we can expect the token to auto-refresh without re-authenticating.
I have an existing python based script which uses botocore API, and I get this exception:
botocore.exceptions.TokenRetrievalError: Error when retrieving token from sso: Token has expired and refresh failedThe above is because the default IAM duration of 8 hours was passed, and I have to re-login/re-authenticate for the token to start refreshing again within the 8 hour period right?
It would be great if you could please clarify it @tim-finnigan
Thanks!
turbotankist commentedon Jul 4, 2024
I found some patterns to this error.
I have 2 profiles in google chrome, in one I am authorised in aws and the other I am not.
And I have opened windows with both profiles. And at some point the default window opens where I am not authorised. If I close it, the issue doesn't happen.
p4v0 commentedon Jul 19, 2024
Same issue here, don't quite understand why on earth this token expires and the refresh fails... this ultimately leads us to make use of non-expirable Access keys.
Chealer commentedon Jul 31, 2024
@tim-finnigan please specify the version which fixes. I'm regularly affected on 2.17.18, and I was experiencing the same with 2.17.9.