Skip to content

Clarify SSO to only suggest a different device when using --use-device-code #9642

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: v2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changes/next-release/enhancement-sso-54764.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "enhancement",
"category": "``sso``",
"description": "Clarify ``aws sso login`` to only suggest a different device when using ``--use-device-code``."
}
22 changes: 15 additions & 7 deletions awscli/customizations/sso/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,21 @@ def __init__(self, outfile=None, open_browser=None):
def __call__(
self, userCode, verificationUri, verificationUriComplete, **kwargs
):
opening_msg = (
f'Attempting to automatically open the SSO authorization page in '
f'your default browser.\nIf the browser does not open or you wish '
f'to use a different device to authorize this request, open the '
f'following URL:\n'
f'\n{verificationUri}\n'
)
if userCode: # only the device code flow supports different devices
opening_msg = (
f'Attempting to automatically open the SSO authorization page '
f'in your default browser.\nIf the browser does not open or '
f'you wish to use a different device to authorize this '
f'request, open the following URL:\n'
f'\n{verificationUri}\n'
)
else:
opening_msg = (
f'Attempting to automatically open the SSO authorization page '
f'in your default browser.\nIf the browser does not open, open '
f'the following URL:\n'
f'\n{verificationUri}\n'
)

user_code_msg = f'\nThen enter the code:\n\n{userCode}\n'
uni_print(opening_msg, self._outfile)
Expand Down
Loading