From 284e301256417f00e2987e45909c23538afe70d2 Mon Sep 17 00:00:00 2001 From: byhsu Date: Mon, 8 May 2023 22:25:30 -0700 Subject: [PATCH] Beautify deviceflow prompt Signed-off-by: byhsu --- flytekit/clients/auth/authenticator.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/flytekit/clients/auth/authenticator.py b/flytekit/clients/auth/authenticator.py index 9582c901d88..5c8b153340d 100644 --- a/flytekit/clients/auth/authenticator.py +++ b/flytekit/clients/auth/authenticator.py @@ -8,7 +8,7 @@ from .auth_client import AuthorizationClient from .exceptions import AccessTokenNotFoundError, AuthenticationError from .keyring import Credentials, KeyringStore - +import click @dataclass class ClientConfig: @@ -224,12 +224,8 @@ def __init__( def refresh_credentials(self): resp = token_client.get_device_code(self._device_auth_endpoint, self._client_id, self._audience, self._scope) - print( - f""" -To Authenticate navigate in a browser to the following URL: {resp.verification_uri} and enter code: {resp.user_code} -OR copy paste the following URL: {resp.verification_uri_complete} - """ - ) + text = f"To Authenticate, navigate in a browser to the following URL: {click.style(resp.verification_uri, fg='blue', underline=True)} and enter code: {click.style(resp.user_code, fg='blue')}" + click.secho(text) try: # Currently the refresh token is not retreived. We may want to add support for refreshTokens so that # access tokens can be refreshed for once authenticated machines