aws configure sso error : (InvalidRequestException) when calling the StartDeviceAuthorization operation #7319
Replies: 10 comments 5 replies
-
Hi @rasheedzrt, thanks for reaching out and sorry to hear you're having issues. As I'm trying to locate the issue, could you share the debug logs by adding Best, |
Beta Was this translation helpful? Give feedback.
-
An error occurred (InvalidRequestException) when calling the StartDeviceAuthorization operation: |
Beta Was this translation helpful? Give feedback.
-
Please find the version info.
Thanks |
Beta Was this translation helpful? Give feedback.
-
Same here. $ aws --version
aws-cli/2.9.23 Python/3.11.2 Darwin/22.3.0 source/x86_64 prompt/off $ aws configure sso --debug
...
SSO region [None]: eu-west-1
SSO registration scopes [sso:account:access]:
2023-02-15 11:59:40,788 - MainThread - botocore.hooks - DEBUG - Event choose-service-name: calling handler <function handle_service_name_alias at 0x1049a6c00>
2023-02-15 11:59:40,816 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /usr/local/Cellar/awscli/2.9.23/libexec/lib/python3.11/site-packages/awscli/botocore/data/sso-oidc/2019-06-10/endpoint-rule-set-1.json
2023-02-15 11:59:40,817 - MainThread - botocore.loaders - DEBUG - Loading JSON file: /usr/local/Cellar/awscli/2.9.23/libexec/lib/python3.11/site-packages/awscli/botocore/data/partitions.json
2023-02-15 11:59:40,817 - MainThread - botocore.hooks - DEBUG - Event creating-client-class.sso-oidc: calling handler <function add_generate_presigned_url at 0x1048fa0c0>
2023-02-15 11:59:40,856 - MainThread - botocore.endpoint - DEBUG - Setting oidc timeout as (60, 60)
2023-02-15 11:59:40,857 - MainThread - botocore.regions - DEBUG - Calling endpoint provider with parameters: {'Region': 'eu-west-1', 'UseDualStack': False, 'UseFIPS': False}
2023-02-15 11:59:40,857 - MainThread - botocore.regions - DEBUG - Endpoint provider result: https://oidc.eu-west-1.amazonaws.com
2023-02-15 11:59:40,857 - MainThread - botocore.hooks - DEBUG - Event provide-client-params.sso-oidc.StartDeviceAuthorization: calling handler <function base64_decode_input_blobs at 0x105fc5440>
2023-02-15 11:59:40,857 - MainThread - botocore.hooks - DEBUG - Event before-parameter-build.sso-oidc.StartDeviceAuthorization: calling handler <function generate_idempotent_uuid at 0x1049c4fe0>
2023-02-15 11:59:40,858 - MainThread - botocore.hooks - DEBUG - Event before-call.sso-oidc.StartDeviceAuthorization: calling handler <function inject_api_version_header_if_needed at 0x1049c6ac0>
2023-02-15 11:59:40,858 - MainThread - botocore.endpoint - DEBUG - Making request for OperationModel(name=StartDeviceAuthorization) with params: {'url_path': '/device_authorization', 'query_string': {}, 'method': 'POST', 'headers': {'Content-Type': 'application/json', 'User-Agent': 'aws-cli/2.9.23 Python/3.11.2 Darwin/22.3.0 source/x86_64 prompt/off command/configure.sso'}, 'body': b'{"clientId": "EVeRKYPX3Wtmc0wWv7WWkmV1LXdlc3QtMQ", "clientSecret": "eyJraWQiOiJrZXktMTU2Njk2ODAxMyIsImFsZyI6IkhTMzg0In0.eyJzZXJpYWxpemVkIjoie1wiY2xpZW50SWRcIjp7XCJ2YWx1ZVwiOlwiRVZlUktZUFgzV3RtYzB3V3Y3V1drbVYxTFhkbGMzUXRNUVwifSxcImlkZW1wb3RlbnRLZXlcIjpudWxsLFwidGVuYW50SWRcIjpudWxsLFwiY2xpZW50TmFtZVwiOlwiYm90b2NvcmUtY2xpZW50LXp2aWN0b3ItZGV2XCIsXCJjbGllbnRUeXBlXCI6XCJQVUJMSUNcIixcInRlbXBsYXRlQXJuXCI6bnVsbCxcInRlbXBsYXRlQ29udGV4dFwiOm51bGwsXCJleHBpcmF0aW9uVGltZXN0YW1wXCI6MTY4NDI0OTA0MC4wODI5MTUwMDAsXCJjcmVhdGVkVGltZXN0YW1wXCI6MTY3NjQ3MzA0MC4wODI5MTUwMDAsXCJ1cGRhdGVkVGltZXN0YW1wXCI6MTY3NjQ3MzA0MC4wODI5MTUwMDAsXCJjcmVhdGVkQnlcIjpudWxsLFwidXBkYXRlZEJ5XCI6bnVsbCxcInN0YXR1c1wiOm51bGwsXCJpbml0aWF0ZUxvZ2luVXJpXCI6bnVsbCxcImVudGl0bGVk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Q.KjKyfRu7yYZuv66JwKp1yJoo22H6WZhyTL8l-Ier1h4TNzMxMGgr7CQ54Y1JMaCJ", "startUrl": "https://zvictor.signin.aws.amazon.com/console"}', 'url': 'https://oidc.eu-west-1.amazonaws.com/device_authorization', 'context': {'client_region': 'eu-west-1', 'client_config': <botocore.config.Config object at 0x106837310>, 'has_streaming_input': False, 'auth_type': 'none'}}
2023-02-15 11:59:40,858 - MainThread - botocore.hooks - DEBUG - Event request-created.sso-oidc.StartDeviceAuthorization: calling handler <bound method RequestSigner.handler of <botocore.signers.RequestSigner object at 0x106800f10>>
2023-02-15 11:59:40,858 - MainThread - botocore.hooks - DEBUG - Event choose-signer.sso-oidc.StartDeviceAuthorization: calling handler <function set_operation_specific_signer at 0x1049c4ea0>
2023-02-15 11:59:40,858 - MainThread - botocore.endpoint - DEBUG - Sending http request: <AWSPreparedRequest stream_output=False, method=POST, url=https://oidc.eu-west-1.amazonaws.com/device_authorization, headers={'Content-Type': b'application/json', 'User-Agent': b'aws-cli/2.9.23 Python/3.11.2 Darwin/22.3.0 source/x86_64 prompt/off command/configure.sso', 'Content-Length': '1938'}>
2023-02-15 11:59:40,859 - MainThread - botocore.httpsession - DEBUG - Certificate path: /usr/local/Cellar/awscli/2.9.23/libexec/lib/python3.11/site-packages/awscli/botocore/cacert.pem
2023-02-15 11:59:40,859 - MainThread - urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): oidc.eu-west-1.amazonaws.com:443
2023-02-15 11:59:41,935 - MainThread - urllib3.connectionpool - DEBUG - https://oidc.eu-west-1.amazonaws.com:443 "POST /device_authorization HTTP/1.1" 400 65
2023-02-15 11:59:41,936 - MainThread - botocore.parsers - DEBUG - Response headers: {'Date': 'Wed, 15 Feb 2023 14:59:42 GMT', 'Content-Type': 'application/json', 'Content-Length': '65', 'Connection': 'keep-alive', 'x-amzn-RequestId': '91ebc35d-31be-4721-97bf-1d8ae9e02789', 'x-amzn-ErrorType': 'InvalidRequestException:http://internal.amazon.com/coral/com.amazonaws.sso.oidc/'}
2023-02-15 11:59:41,936 - MainThread - botocore.parsers - DEBUG - Response body:
b'{"error":"invalid_request","error_description":"Invalid request"}'
2023-02-15 11:59:41,936 - MainThread - botocore.parsers - DEBUG - Response headers: {'Date': 'Wed, 15 Feb 2023 14:59:42 GMT', 'Content-Type': 'application/json', 'Content-Length': '65', 'Connection': 'keep-alive', 'x-amzn-RequestId': '91ebc35d-31be-4721-97bf-1d8ae9e02789', 'x-amzn-ErrorType': 'InvalidRequestException:http://internal.amazon.com/coral/com.amazonaws.sso.oidc/'}
2023-02-15 11:59:41,936 - MainThread - botocore.parsers - DEBUG - Response body:
b'{"error":"invalid_request","error_description":"Invalid request"}'
2023-02-15 11:59:41,936 - MainThread - botocore.hooks - DEBUG - Event needs-retry.sso-oidc.StartDeviceAuthorization: calling handler <bound method RetryHandler.needs_retry of <botocore.retries.standard.RetryHandler object at 0x106838e90>>
2023-02-15 11:59:41,937 - MainThread - botocore.retries.standard - DEBUG - Not retrying request.
2023-02-15 11:59:41,937 - MainThread - botocore.hooks - DEBUG - Event after-call.sso-oidc.StartDeviceAuthorization: calling handler <bound method RetryQuotaChecker.release_retry_quota of <botocore.retries.standard.RetryQuotaChecker object at 0x1067ee490>>
2023-02-15 11:59:41,938 - MainThread - awscli.clidriver - DEBUG - Exception caught in main()
Traceback (most recent call last):
File "/usr/local/Cellar/awscli/2.9.23/libexec/lib/python3.11/site-packages/awscli/clidriver.py", line 460, in main
return command_table[parsed_args.command](remaining, parsed_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/awscli/2.9.23/libexec/lib/python3.11/site-packages/awscli/customizations/commands.py", line 151, in __call__
return self._subcommand_table[subcommand_name](
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/awscli/2.9.23/libexec/lib/python3.11/site-packages/awscli/customizations/commands.py", line 205, in __call__
rc = self._run_main(parsed_args, parsed_globals)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/awscli/2.9.23/libexec/lib/python3.11/site-packages/awscli/customizations/configure/sso.py", line 516, in _run_main
sso_token = self._sso_login(
^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/awscli/2.9.23/libexec/lib/python3.11/site-packages/awscli/customizations/sso/utils.py", line 72, in do_sso_login
return token_fetcher.fetch_token(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/awscli/2.9.23/libexec/lib/python3.11/site-packages/awscli/botocore/utils.py", line 3052, in fetch_token
return self._token(
^^^^^^^^^^^^
File "/usr/local/Cellar/awscli/2.9.23/libexec/lib/python3.11/site-packages/awscli/botocore/utils.py", line 3037, in _token
token = self._poll_for_token(
^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/awscli/2.9.23/libexec/lib/python3.11/site-packages/awscli/botocore/utils.py", line 2952, in _poll_for_token
authorization = self._authorize_client(start_url, registration)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/awscli/2.9.23/libexec/lib/python3.11/site-packages/awscli/botocore/utils.py", line 2929, in _authorize_client
response = self._client.start_device_authorization(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/awscli/2.9.23/libexec/lib/python3.11/site-packages/awscli/botocore/client.py", line 341, in _api_call
return self._make_api_call(operation_name, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/Cellar/awscli/2.9.23/libexec/lib/python3.11/site-packages/awscli/botocore/client.py", line 697, in _make_api_call
raise error_class(parsed_response, operation_name)
botocore.errorfactory.InvalidRequestException: An error occurred (InvalidRequestException) when calling the StartDeviceAuthorization operation:
An error occurred (InvalidRequestException) when calling the StartDeviceAuthorization operation: |
Beta Was this translation helpful? Give feedback.
-
The issue with me was that the Authentication URL was incorrect. In my case, I have sso_start_url as a parameter in my config file, and there was an extra character in there. |
Beta Was this translation helpful? Give feedback.
-
We're using Okta and I was getting the same error. I ended up having to use okta-aws-cli-assume-role. After that, I could just call |
Beta Was this translation helpful? Give feedback.
-
Same error. It seems (looking at the logs) that there is a silly error with marshalling a Possibly, an update of bootcore changed a map to an object. Looks like a simple and very necessary fix. |
Beta Was this translation helpful? Give feedback.
-
just for sake of completeness this is the payload which gets received in the first request then posted to the 400 one: {
"clientId": {
"value": "Bg3CWOFgn-JHWFDg3cDx5GV1LWNlbnRyYWwtMQ"
},
"idempotentKey": null,
"tenantId": null,
"clientName": "botocore-client-u",
"clientType": "PUBLIC",
"templateArn": null,
"templateContext": null,
"expirationTimestamp": 1693413579.485812,
"createdTimestamp": 1685637579.485812,
"updatedTimestamp": 1685637579.485812,
"createdBy": null,
"updatedBy": null,
"status": null,
"initiateLoginUri": null,
"entitledResourceId": null,
"entitledResourceContainerId": null,
"externalId": null,
"softwareId": null,
"scopes": [
{
"friendlyId": "sso",
"useCaseAction": "account:access",
"applicationArn": null,
"scopeType": "ACCESS_SCOPE",
"type": "ImmutableAccessScope",
"fullScope": "sso:account:access",
"status": "INITIAL"
}
],
"authenticationConfiguration": null,
"enabledGrants": null,
"shouldGetValueFromTemplate": true,
"hasInitialScopes": true,
"hasRequestedScopes": false,
"areAllScopesConsentedTo": false,
"groupScopesByFriendlyId": {
"sso": [
{
"friendlyId": "sso",
"useCaseAction": "account:access",
"applicationArn": null,
"scopeType": "ACCESS_SCOPE",
"type": "ImmutableAccessScope",
"fullScope": "sso:account:access",
"status": "INITIAL"
}
]
},
"containsOnlySsoScopes": true,
"isExpired": false
} |
Beta Was this translation helpful? Give feedback.
-
Getting the same error here Here is the stack dump 2023-06-14 17:47:55,148 - MainThread - awscli.clidriver - DEBUG - Exception caught in main() |
Beta Was this translation helpful? Give feedback.
-
For anyone else who runs into this problem, I was able to resolve the issue by removing all files in |
Beta Was this translation helpful? Give feedback.
-
Hi,
I was trying to configure sso using azuread but I'm seeing this below error.
An error occurred (InvalidRequestException) when calling the StartDeviceAuthorization operation:
can anyone please suggest why do we see this error, I was going through the aws documentation and I see that this could be due to some parameters missing and other other issues.
I've tried to setup debug parameteres too but couldn't get much info.
`[default]
region = us-east-1
saml_auth_url = https://myapps.microsoft.com/signin/app-id?tenantId=client-id
saml_username = [email protected]
saml_provider = azuread
output = json
[profile nonprodus]
region = us-east-1
saml_auth_url = https://myapps.microsoft.com/signin/app-id?tenantId=client-id
saml_username = [email protected]
role_arn = arn:aws:iam::account-number:role/PowerUser
source_profile = default
[profile produs]
region = us-east-1
saml_auth_url = https://myapps.microsoft.com/signin/app-id?tenantId=client-id
role_arn = arn:aws:iam::account-number:role/PowerUser
source_profile = default`
Thanks,
Rasheed
Beta Was this translation helpful? Give feedback.
All reactions