Skip to content

Conversation

@benceruleanlu
Copy link
Member

@benceruleanlu benceruleanlu commented Aug 31, 2025

Summary

  • Fixed logout functionality to properly clear both Firebase authentication and API key
  • Updated CurrentUserPopover component to use the correct logout handler

Problem

When logging out via the avatar dropdown in the top right, the logout function was only clearing Firebase authentication but not the stored API key. This could leave users partially authenticated with their API key still active after appearing to log out.

Solution

Updated CurrentUserPopover.vue to use handleSignOut from the useCurrentUser composable instead of directly calling authActions.logout(). The handleSignOut method properly handles both authentication methods:

  • Clears API key if logged in with API key
  • Signs out Firebase if logged in with Firebase

This ensures complete logout regardless of authentication method.

Console commands to verify auth state:

// Check Firebase auth
const firebaseStore = (await import('./src/stores/firebaseAuthStore.ts')).useFirebaseAuthStore()
console.log('Firebase authenticated:', firebaseStore.isAuthenticated)

// Check API key
const apiKeyStore = (await import('./src/stores/apiKeyAuthStore.ts')).useApiKeyAuthStore()
console.log('Has API key:', !!apiKeyStore.getApiKey())

Fixes #5261

🤖 Generated with Claude Code

┆Issue is synchronized with this Notion page by Unito

When logging out via the avatar dropdown, the logout function was only
clearing Firebase authentication but not the stored API key. This could
leave users partially authenticated with their API key still active.

Updated CurrentUserPopover to use handleSignOut from useCurrentUser
composable, which properly handles both authentication methods:
- Clears API key if logged in with API key
- Signs out Firebase if logged in with Firebase

This ensures complete logout regardless of authentication method.

Fixes #5261

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@benceruleanlu benceruleanlu requested a review from a team as a code owner August 31, 2025 00:22
@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Aug 31, 2025
@github-actions
Copy link

github-actions bot commented Aug 31, 2025

🎭 Playwright Test Results

All tests passed across all browsers!

⏰ Completed at: 08/31/2025, 12:49:43 AM UTC

📊 Test Reports by Browser


🎉 Your tests are passing across all browsers!

@github-actions
Copy link

github-actions bot commented Aug 31, 2025

🎨 Storybook Build Status

Build is starting...

⏰ Started at: 08/31/2025, 12:26:17 AM UTC

🚀 Building Storybook

  • 📦 Installing dependencies...
  • 🔧 Building Storybook components...
  • 🎨 Running Chromatic visual tests...

⏱️ Please wait while the Storybook build is in progress...

@github-actions
Copy link

🎨 Storybook Build Status

Build is starting...

⏰ Started at: 08/31/2025, 12:22:57 AM UTC

🚀 Building Storybook

  • 📦 Installing dependencies...
  • 🔧 Building Storybook components...
  • 🎨 Running Chromatic visual tests...

⏱️ Please wait while the Storybook build is in progress...

Updated test mocks to include handleSignOut from useCurrentUser composable
and adjusted test expectations to verify handleSignOut is called instead
of the direct logout method.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Aug 31, 2025
Copy link
Contributor

@christian-byrne christian-byrne left a comment

Choose a reason for hiding this comment

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

LGTM, nice work

@christian-byrne christian-byrne merged commit 68c4183 into main Aug 31, 2025
17 checks passed
@christian-byrne christian-byrne deleted the fix-logout-api-key-cleanup branch August 31, 2025 02:46
snomiao pushed a commit that referenced this pull request Aug 31, 2025
* fix: Ensure logout clears both Firebase auth and API key

When logging out via the avatar dropdown, the logout function was only
clearing Firebase authentication but not the stored API key. This could
leave users partially authenticated with their API key still active.

Updated CurrentUserPopover to use handleSignOut from useCurrentUser
composable, which properly handles both authentication methods:
- Clears API key if logged in with API key
- Signs out Firebase if logged in with Firebase

This ensures complete logout regardless of authentication method.

Fixes #5261

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* test: Update CurrentUserPopover tests to match new logout implementation

Updated test mocks to include handleSignOut from useCurrentUser composable
and adjusted test expectations to verify handleSignOut is called instead
of the direct logout method.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
@benceruleanlu benceruleanlu mentioned this pull request Sep 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:auth size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Log Out button in top right popover doesn't log out

3 participants