Skip to content

Commit

Permalink
Feat: If PKCE AuthorizationClient cannot open browser, ask user to do…
Browse files Browse the repository at this point in the history
… so manually (flyteorg#1947)

* If PKCE AuthorizationClient cannot open browser, ask user to do so manually

Signed-off-by: Fabio Grätz <[email protected]>

* Remove new line

Signed-off-by: Fabio Grätz <[email protected]>

---------

Signed-off-by: Fabio Grätz <[email protected]>
Co-authored-by: Fabio Grätz <[email protected]>
  • Loading branch information
fg91 and Fabio Grätz authored Nov 9, 2023
1 parent 6998304 commit 94a561c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion flytekit/clients/auth/auth_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from multiprocessing import get_context
from urllib.parse import urlencode as _urlencode

import click
import requests as _requests

from .default_html import get_default_success_html
Expand Down Expand Up @@ -281,7 +282,10 @@ def _request_authorization_code(self):
query = _urlencode(self._request_auth_code_params)
endpoint = _urlparse.urlunparse((scheme, netloc, path, None, query, None))
logging.debug(f"Requesting authorization code through {endpoint}")
_webbrowser.open_new_tab(endpoint)

success = _webbrowser.open_new_tab(endpoint)
if not success:
click.secho(f"Please open the following link in your browser to authenticate: {endpoint}")

def _credentials_from_response(self, auth_token_resp) -> Credentials:
"""
Expand Down

0 comments on commit 94a561c

Please sign in to comment.