Skip to content

Add logfire auth logout command#1781

Merged
Viicos merged 3 commits intopydantic:mainfrom
ai-man-codes:feat/auth-logout-command
Mar 17, 2026
Merged

Add logfire auth logout command#1781
Viicos merged 3 commits intopydantic:mainfrom
ai-man-codes:feat/auth-logout-command

Conversation

@ai-man-codes
Copy link
Copy Markdown
Contributor

@ai-man-codes ai-man-codes commented Mar 16, 2026

Description

This PR implements the logfire auth logout command, allowing users to remove their stored credentials from ~/.logfire/default.toml directly via the CLI.

Closes #1596

Changes

  • Core: Added logout(base_url) method to UserTokenCollection in logfire/_internal/auth.py to handle targeted and complete token removal.
  • CLI Handler: Added parse_logout() in logfire/_internal/cli/auth.py.
  • Testing: Added tests in tests/test_auth.py and tests/test_cli.py.

Usage

logfire auth logout               # Log out of all regions

logfire --region us auth logout   # Log out of a specific region

Summary by cubic

Adds the logfire auth logout subcommand to remove saved credentials in ~/.logfire/default.toml for all regions or a specific region. Shows per-URL success, clear errors, and exits with code 1 on failure.

  • New Features
    • Implemented UserTokenCollection.logout(base_url=None) to delete token(s), persist changes, return removed URL(s), and raise LogfireConfigError when not logged in or URL not found.
    • Added CLI auth logout (parse_logout) under auth; respects --region or logs out from all; prints per-URL confirmation and the final removal path; exits 1 on errors.
    • Updated stubs in logfire-api and added tests for single/multiple removal, wrong/missing region, not-logged-in cases, and CLI outputs/exit codes.

Written for commit 5327757. Summary will update on new commits.

devin-ai-integration[bot]

This comment was marked as resolved.

cubic-dev-ai[bot]

This comment was marked as resolved.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@ai-man-codes ai-man-codes force-pushed the feat/auth-logout-command branch 2 times, most recently from d8aa117 to 79d04ff Compare March 16, 2026 15:49
@alexmojaki alexmojaki requested a review from Viicos March 16, 2026 16:20
@Viicos Viicos changed the title feat: add logfire auth logout command Add logfire auth logout command Mar 17, 2026
@Viicos Viicos enabled auto-merge (squash) March 17, 2026 07:42
@Viicos Viicos merged commit 663a132 into pydantic:main Mar 17, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No logout/change account with logfire cli

2 participants