Skip to content

Comments

Fix: Clear auth state when switching from multiuser to single-user mode#86

Merged
lstein merged 1 commit intofeature/multiuserfrom
copilot/fix-login-persistence-issue
Feb 23, 2026
Merged

Fix: Clear auth state when switching from multiuser to single-user mode#86
lstein merged 1 commit intofeature/multiuserfrom
copilot/fix-login-persistence-issue

Conversation

Copy link

Copilot AI commented Feb 23, 2026

Summary

When switching InvokeAI from multiuser → single-user mode, a JWT token persisted in localStorage kept the Redux auth state as "authenticated", causing the user icon to remain visible without requiring a manual logout.

Changes in ProtectedRoute.tsx:

  • Auto-logout on mode switch: When multiuser_enabled is false but isAuthenticated is true, dispatch logout() to clear both the localStorage token and Redux auth state — the user icon disappears automatically on page load in single-user mode.
  • Skip user fetch in single-user mode: Added multiuserEnabled guard to shouldFetchUser to prevent a race where useGetCurrentUserQuery could populate user state before the logout effect ran.

Related Issues / Discussions

QA Instructions

  1. Start InvokeAI in multiuser mode (multiuser: true in invokeai.yaml), navigate to the app, and log in.
  2. Stop the server, set multiuser: false, restart.
  3. Reload the page — the user icon should no longer appear without needing to manually log out.

Merge Plan

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added / updated (if applicable)
  • ❗Changes to a redux slice have a corresponding migration
  • Documentation added / updated (if applicable)
  • Updated What's New copy (if doing a release after this PR)
Original prompt

This section details on the original issue you should resolve

<issue_title>[bug]: Login persists when invoke is moved from multiuser mode to singleuser mode</issue_title>
<issue_description>### Is there an existing issue for this problem?

  • I have searched the existing issues

Install method

Invoke's Launcher

Operating system

Linux

GPU vendor

Nvidia (CUDA)

GPU model

No response

GPU VRAM

No response

Version number

feature/multiuser

Browser

No response

System Information

No response

What happened

I was running InvokeAI in multiuser mode and logged in as a user. I then killed the server, switched from multiuser to singleuser mode (by setting multiuser: false in invokeai.yaml) and then reloaded the page. I saw that the user icon was still present and showed myself logged in as a user. When I clicked the "logout" button, the user icon disappeared and all was as expected for single user mode.

What you expected to happen

When invokeai is put into single-user mode, I expect the user icon to disappear without my having to log out.

How to reproduce the problem

No response

Additional context

No response

Discord username

No response</issue_description>

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI changed the title [WIP] Fix login persistence when switching to singleuser mode Fix: Clear auth state when switching from multiuser to single-user mode Feb 23, 2026
Copilot AI requested a review from lstein February 23, 2026 03:20
@lstein lstein marked this pull request as ready for review February 23, 2026 03:39
Co-authored-by: lstein <111189+lstein@users.noreply.github.com>
@lstein lstein force-pushed the copilot/fix-login-persistence-issue branch from 8fd6147 to 78b5783 Compare February 23, 2026 03:44
Copy link
Owner

@lstein lstein left a comment

Choose a reason for hiding this comment

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

Works as advertised.

@lstein lstein merged commit a0b6359 into feature/multiuser Feb 23, 2026
13 checks passed
@lstein lstein deleted the copilot/fix-login-persistence-issue branch February 23, 2026 03:46
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