Skip to content

πŸ§‘β€πŸ’» Handle already logged in state#103

Merged
patrick91 merged 11 commits into
mainfrom
ref/update-login
Nov 17, 2025
Merged

πŸ§‘β€πŸ’» Handle already logged in state#103
patrick91 merged 11 commits into
mainfrom
ref/update-login

Conversation

@alejsdev
Copy link
Copy Markdown
Contributor

πŸ§‘β€πŸ’» Handle already logged in state

@alejsdev alejsdev marked this pull request as ready for review October 28, 2025 14:42
@alejsdev alejsdev requested a review from patrick91 October 28, 2025 14:42
Comment thread src/fastapi_cloud_cli/commands/login.py Outdated
Comment on lines +88 to +98
if is_logged_in():
with APIClient() as client:
is_valid, email = _verify_token(client)

if is_valid:
with get_rich_toolkit(minimal=True) as toolkit:
toolkit.print(f"Already logged in as [bold]{email}[/bold]")
toolkit.print(
"Run [bold]fastapi logout[/bold] first if you want to switch accounts."
)
return
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a PR to avoid doing any HTTP call, we will validate that the token is still valid

#105

(it could be invalid for other reasons, but I think I prefer avoiding doing an HTTP call)

what do you think?

@alejsdev alejsdev marked this pull request as draft November 17, 2025 09:27
@alejsdev alejsdev marked this pull request as ready for review November 17, 2025 12:08
Copy link
Copy Markdown
Collaborator

@patrick91 patrick91 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@patrick91 patrick91 merged commit a30cc59 into main Nov 17, 2025
11 checks passed
@patrick91 patrick91 deleted the ref/update-login branch November 17, 2025 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants