Skip to content

Commit

Permalink
chore: update print and fix cors error (#4829)
Browse files Browse the repository at this point in the history
  • Loading branch information
xianml authored Jun 26, 2024
1 parent 0ea601a commit 03fcd24
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/bentoml_cli/auth_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,6 @@ def wait_indefinitely_for_code(self) -> Optional[str]:
"""
Wait indefinitely for ther server to callback from token provider.
"""
self.handle_request()
while self._code is None:
self.handle_request()
return self.get_code()
7 changes: 4 additions & 3 deletions src/bentoml_cli/cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ def login(shared_options: SharedOptions, endpoint: str, api_token: str) -> None:
reserve_free_port(enable_so_reuseport=True)
)
callback_server = AuthCallbackHttpServer(port)
endpoint = endpoint.rstrip("/")
baseURL = f"{endpoint}/api_tokens"
encodedCallback = urllib.parse.quote(callback_server.callback_url)
authURL = f"{baseURL}?callback={encodedCallback}"
Expand Down Expand Up @@ -122,9 +123,9 @@ def login(shared_options: SharedOptions, endpoint: str, api_token: str) -> None:
rich.print(
f"✅ Configured BentoCloud credentials (current-context: {ctx.name})"
)
email = click.style(user.email, fg="green")
org_name = click.style(org.name, fg="green")
rich.print(f"✅ Logged in as {email} at {org_name} organization")
rich.print(
f"✅ Logged in as [blue]{user.email}[/] at [blue]{org.name}[/] organization"
)
except CloudRESTApiClientError as e:
if e.error_code == 401:
rich.print(
Expand Down

0 comments on commit 03fcd24

Please sign in to comment.