From fd09894dd4a72dd5017ea7f4aec1ed544f78d979 Mon Sep 17 00:00:00 2001 From: Ashen Gunaratne Date: Sun, 15 Mar 2026 05:29:03 +0000 Subject: [PATCH] Allow OAuth callback port override --- awscli/customizations/sso/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/awscli/customizations/sso/utils.py b/awscli/customizations/sso/utils.py index 94062460f55d..e67e11948c50 100644 --- a/awscli/customizations/sso/utils.py +++ b/awscli/customizations/sso/utils.py @@ -226,7 +226,8 @@ def __init__(self): # AuthCodeFetcher so that it can pass back the state and auth code try: handler = partial(OAuthCallbackHandler, self) - self.http_server = HTTPServer(('', 0), handler) + server_port = os.environ.get('AWS_OAUTH_CALLBACK_SERVER_PORT', 0) + self.http_server = HTTPServer(('', server_port), handler) self.http_server.timeout = self._REQUEST_TIMEOUT except OSError as e: raise AuthCodeFetcherError(error_msg=e)