Skip to content

Commit 130005a

Browse files
authored
[V2] Add the OAuth Authorization Code Flow with PKCE (#8947)
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.
1 parent 44782d4 commit 130005a

File tree

9 files changed

+1167
-87
lines changed

9 files changed

+1167
-87
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"type": "feature",
3+
"category": "``sso``",
4+
"description": "Add support and default to the OAuth 2.0 Authorization Code Flow with PKCE for ``aws sso login``."
5+
}

awscli/botocore/exceptions.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,14 +674,18 @@ class SSOError(BotoCoreError):
674674
class PendingAuthorizationExpiredError(SSOError):
675675
fmt = (
676676
"The pending authorization to retrieve an SSO token has expired. The "
677-
"device authorization flow to retrieve an SSO token must be restarted."
677+
"login flow to retrieve an SSO token must be restarted."
678678
)
679679

680680

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

684684

685+
class AuthorizationCodeLoadError(SSOError):
686+
fmt = "Error loading authorization code: {error_msg}"
687+
688+
685689
class UnauthorizedSSOTokenError(SSOError):
686690
fmt = (
687691
"The SSO session associated with this profile has expired or is "
@@ -690,6 +694,14 @@ class UnauthorizedSSOTokenError(SSOError):
690694
)
691695

692696

697+
class AuthCodeFetcherError(SSOError):
698+
fmt = (
699+
"Unable to initialize the OAuth 2.0 authorization callback handler: "
700+
"{error_msg} \n You may use --use-device-code to fall back to the "
701+
"device code flow which does not require the callback handler."
702+
)
703+
704+
693705
class CapacityNotAvailableError(BotoCoreError):
694706
fmt = (
695707
'Insufficient request capacity available.'

0 commit comments

Comments
 (0)