[PR #6545] [PM-32356] Fix: Use soft logout for token refresh failures to preserve account #12806

Closed
opened 2026-04-11 03:51:33 -05:00 by GiteaMirror · 0 comments
Owner

Original Pull Request: https://github.com/bitwarden/android/pull/6545

State: closed
Merged: Yes


📔 Objective

When a refresh token expires or becomes invalid, the app was performing
a hard logout which completely removed the account from the account list.
This caused users to be automatically switched to another account and
forced them to re-add their server URL and account details.

This change uses softLogout() instead of logout() when token refresh
fails, which:

  • Keeps the account in the account switcher
  • Preserves PIN and vault timeout settings
  • Allows users to simply re-authenticate with their password
  • Prevents unexpected account switching

This fixes the issue where users with multiple accounts (especially
those with self-hosted instances on private VPN networks) would lose
access to their accounts after being offline for extended periods.

Fixes token refresh error handling for:

  • InvalidGrant (expired refresh token)
  • RefreshForbidden (403 response)
  • RefreshUnauthorized (401 response)

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

**Original Pull Request:** https://github.com/bitwarden/android/pull/6545 **State:** closed **Merged:** Yes --- ## 📔 Objective When a refresh token expires or becomes invalid, the app was performing a hard logout which completely removed the account from the account list. This caused users to be automatically switched to another account and forced them to re-add their server URL and account details. This change uses `softLogout()` instead of `logout()` when token refresh fails, which: - Keeps the account in the account switcher - Preserves PIN and vault timeout settings - Allows users to simply re-authenticate with their password - Prevents unexpected account switching This fixes the issue where users with multiple accounts (especially those with self-hosted instances on private VPN networks) would lose access to their accounts after being offline for extended periods. Fixes token refresh error handling for: - InvalidGrant (expired refresh token) - RefreshForbidden (403 response) - RefreshUnauthorized (401 response) Co-Authored-By: Claude <noreply@anthropic.com>
GiteaMirror added the pull-request label 2026-04-11 03:51:33 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/android#12806