[PR #1730] [MERGED] Fix for initial login token storage paradox #3078

Closed
opened 2025-11-26 23:28:01 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/bitwarden/android/pull/1730
Author: @mpbw2
Created: 1/24/2022
Status: Merged
Merged: 1/25/2022
Merged by: @mpbw2

Base: accountswitchingHead: accountswitching-login-bugfix


📝 Commits (1)

  • f399943 fix for initial login token storage paradox

📊 Changes

3 files changed (+7 additions, -4 deletions)

View changed files

📝 src/Core/Abstractions/ITokenService.cs (+1 -1)
📝 src/Core/Services/AuthService.cs (+1 -1)
📝 src/Core/Services/TokenService.cs (+5 -2)

📄 Description

Type of change

  • Bug fix
  • New feature development
  • Tech debt (refactoring, code cleanup, dependency upgrades, etc)
  • Build/deploy pipeline (DevOps)
  • Other

Objective

Fix NPE on login with account that has never logged in before (recent change in the way skipping token storage is handled combined with a fresh install)

Code changes

  • TokenService.cs: Added forDecodeOnly bool to SetAccessTokenAsync method to allow token decoding without saving to the account state (which doesn't exist until the next step in the auth process, which requires values from the decoded token)
  • AuthService.cs: Utilize the new bool

Testing requirements

Login with a fresh install and boom. Apparently it's been awhile since I cleared app data.

Before you submit

  • I have added unit tests where it makes sense to do so (encouraged but not required)
  • This change requires a documentation update (notify the documentation team)
  • This change has particular deployment requirements (notify the DevOps team)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/bitwarden/android/pull/1730 **Author:** [@mpbw2](https://github.com/mpbw2) **Created:** 1/24/2022 **Status:** ✅ Merged **Merged:** 1/25/2022 **Merged by:** [@mpbw2](https://github.com/mpbw2) **Base:** `accountswitching` ← **Head:** `accountswitching-login-bugfix` --- ### 📝 Commits (1) - [`f399943`](https://github.com/bitwarden/android/commit/f3999435151d58cb6e1104a471595fb6c05a8f90) fix for initial login token storage paradox ### 📊 Changes **3 files changed** (+7 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `src/Core/Abstractions/ITokenService.cs` (+1 -1) 📝 `src/Core/Services/AuthService.cs` (+1 -1) 📝 `src/Core/Services/TokenService.cs` (+5 -2) </details> ### 📄 Description ## Type of change - [X] Bug fix - [ ] New feature development - [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc) - [ ] Build/deploy pipeline (DevOps) - [ ] Other ## Objective <!--Describe what the purpose of this PR is. For example: what bug you're fixing or what new feature you're adding--> Fix NPE on login with account that has never logged in before (recent change in the way skipping token storage is handled combined with a fresh install) ## Code changes <!--Explain the changes you've made to each file or major component. This should help the reviewer understand your changes--> <!--Also refer to any related changes or PRs in other repositories--> * **TokenService.cs:** Added `forDecodeOnly` bool to `SetAccessTokenAsync` method to allow token decoding without saving to the account state (which doesn't exist until the next step in the auth process, which requires values from the decoded token) * **AuthService.cs:** Utilize the new bool ## Testing requirements <!--What functionality requires testing by QA? This includes testing new behavior and regression testing--> Login with a fresh install and boom. Apparently it's been awhile since I cleared app data. ## Before you submit - [ ] I have added **unit tests** where it makes sense to do so (encouraged but not required) - [ ] This change requires a **documentation update** (notify the documentation team) - [ ] This change has particular **deployment requirements** (notify the DevOps team) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2025-11-26 23:28:01 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/android#3078