Skip to content

Commit

Permalink
Add the OAuth Authorization Code Flow with PKCE
Browse files Browse the repository at this point in the history
This adds support for the OAuth2.0 authorization code flow with PKCE to the
aws sso login command. It is the new default behavior, but users can fall back to
the device code flow using the new --use-device-code option.
  • Loading branch information
ashovlin committed Nov 15, 2024
1 parent ad791c0 commit e0ee9eb
Show file tree
Hide file tree
Showing 9 changed files with 1,150 additions and 87 deletions.
5 changes: 5 additions & 0 deletions .changes/next-release/feature-sso-81096.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "feature",
"category": "``sso``",
"description": "Add support and default to the OAuth 2.0 Authorization Code Flow with PKCE for ``aws sso login``."
}
14 changes: 13 additions & 1 deletion awscli/botocore/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -674,14 +674,18 @@ class SSOError(BotoCoreError):
class PendingAuthorizationExpiredError(SSOError):
fmt = (
"The pending authorization to retrieve an SSO token has expired. The "
"device authorization flow to retrieve an SSO token must be restarted."
"login flow to retrieve an SSO token must be restarted."
)


class SSOTokenLoadError(SSOError):
fmt = "Error loading SSO Token: {error_msg}"


class AuthorizationCodeLoadError(SSOError):
fmt = "Error loading authorization code: {error_msg}"


class UnauthorizedSSOTokenError(SSOError):
fmt = (
"The SSO session associated with this profile has expired or is "
Expand All @@ -690,6 +694,14 @@ class UnauthorizedSSOTokenError(SSOError):
)


class AuthCodeFetcherError(SSOError):
fmt = (
"Unable to initialize the OAuth 2.0 authorization callback handler: "
"{error_msg} \n You may use --use-device-code to fall back to the "
"device code flow which does not require the callback handler."
)


class CapacityNotAvailableError(BotoCoreError):
fmt = (
'Insufficient request capacity available.'
Expand Down
Loading

0 comments on commit e0ee9eb

Please sign in to comment.