From a40ccad6bef36c9b6d96eeb1a597aba5c59073dd Mon Sep 17 00:00:00 2001 From: ByronHsu Date: Fri, 19 May 2023 10:32:07 -0700 Subject: [PATCH] Beautify deviceflow prompt (#1625) * Beautify deviceflow prompt Signed-off-by: byhsu * lint! Signed-off-by: byhsu * lint Signed-off-by: byhsu --------- Signed-off-by: byhsu Co-authored-by: byhsu --- flytekit/clients/auth/authenticator.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/flytekit/clients/auth/authenticator.py b/flytekit/clients/auth/authenticator.py index bde25602e0..8461e1e713 100644 --- a/flytekit/clients/auth/authenticator.py +++ b/flytekit/clients/auth/authenticator.py @@ -4,6 +4,8 @@ from abc import abstractmethod from dataclasses import dataclass +import click + from . import token_client from .auth_client import AuthorizationClient from .exceptions import AccessTokenNotFoundError, AuthenticationError @@ -240,11 +242,8 @@ def refresh_credentials(self): resp = token_client.get_device_code( self._device_auth_endpoint, self._client_id, self._audience, self._scope, self._http_proxy_url ) - print( - f""" -To Authenticate navigate in a browser to the following URL: {resp.verification_uri} and enter code: {resp.user_code} - """ - ) + 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