Okta AWS CLI Fails on Windows and Linux with a Subject Token Assurance Requirements Error
Last Updated:
Overview
On Windows and Linux, the Okta Amazon Web Services (AWS) command-line interface (CLI) fails to retrieve credentials because Okta incorrectly initiates a silent Okta Verify device check. Append the short user agent flag to the CLI command to bypass this check and retrieve credentials successfully. When this error occurs, the CLI exits with the following message after the user approves the device code in the browser:
invalid_grant: The application's assurance requirements are not met by the 'subject_token'
The System Log displays a failed app.oauth2.token.grant event for the OpenID Connect (OIDC) application.
Applies To
- Okta Identity Engine (OIE)
- Okta AWS CLI
- Windows
- Linux
- Okta Device Access
Cause
When the Okta AWS CLI exchanges tokens for a web Single Sign-On (SSO) token, Okta evaluates the AWS application authentication policy without prompting the user. Okta determines whether to start the check from the User-Agent string of the request. The default Okta AWS CLI User-Agent includes the operating system. On Windows and Linux, this operating system information causes Okta to incorrectly start a silent Okta Verify device check. The CLI cannot respond to the check, which stops the policy evaluation and rejects the exchange.
Solution
What steps modify the Okta AWS CLI user agent?
Verify the CLI version and execute the command with the short user agent flag.
- Check the CLI version by entering
okta-aws-cli --version.
NOTE: The--short-user-agentflag requires version 2.4.0 or later. - Append the
--short-user-agentflag to the standard command and run the CLI.okta-aws-cli web --short-user-agent <flags> - Confirm the CLI returns AWS credentials.
