Update push token on login to allow multiple users on mobile devices#2404
Merged
Update push token on login to allow multiple users on mobile devices#2404
Conversation
(cherry picked from commit 5e3f6db)
(cherry picked from commit 75d299ae269eeb8ac272c96458815a359ea6d085)
(cherry picked from commit bdad6cf)
5 tasks
differsthecat
approved these changes
Nov 16, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://bitwarden.atlassian.net/browse/SG-816
https://bitwarden.atlassian.net/browse/SG-814
https://bitwarden.atlassian.net/browse/SG-823
Type of change
Objective
We are experiencing a problem today where push notifications are not being sent to mobile devices when there are multiple users logged in.
There is still a scenario where no push token would get set for a given user + device combination, and that would be if a user logs in to a device and gets an access token prior to the PNS providing a push token to the device. However, if such a scenario occurs, the user can log out and log back in with that user and the token would be updated on the subsequent authentication request.
Code changes
BaseRequestValidator.cs:
CreateOrUpdateRegistrationAsync()(as a part ofSaveAsync()on theDeviceService) when it was a new device. This meant that subsequent login requests never updated the push token.AuthRequestsController:
userIdto lookup for the correct device, in case there are multiple logged inBefore you submit
dotnet format --verify-no-changes) (required)