Skip to content

[SG-823] Set push token on login#2189

Closed
trmartin4 wants to merge 2 commits intomasterfrom
SG-816-add-push-token
Closed

[SG-823] Set push token on login#2189
trmartin4 wants to merge 2 commits intomasterfrom
SG-816-add-push-token

Conversation

@trmartin4
Copy link
Member

@trmartin4 trmartin4 commented Nov 13, 2022

https://bitwarden.atlassian.net/browse/SG-823

Type of change

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

Objective

One of the ways that a push token can be sent to the server (to subsequently be passed to the Azure Notification Hub) is on a login request. The server-side code will check for the Device information on the POST body and update the push token for the given user and device, if it exists.

This change is to populate the PushToken property on that object before it is sent on the request. Previously, all properties were set on the object except for the push token.

Code changes

DeviceRequest.cs: Added parameter to constructor for push token.
AuthService.cs: Looked up current push token from state service and passed that in to the object that is used to send the push token on the login request.
PushNotificationListenerService.cs:: Previously, SetCurrentPushTokenAsync() was only called if we were on an Android device, as it was only used for handling Android's re-generation of tokens (we compare Registered vs. Current tokens and update when they don't match). However, now we need a way to keep the current token in state even for iOS devices, as we'll be using it on login requests.

bitwarden/server#2404 is also associated with this same problem.

Before you submit

  • Please check for formatting errors (dotnet format --verify-no-changes) (required)
  • Please add unit tests where it makes sense to do so (encouraged but not required)
  • If this change requires a documentation update - notify the documentation team
  • If this change has particular deployment requirements - notify the DevOps team

@trmartin4 trmartin4 requested a review from a team November 13, 2022 15:31
Copy link

@gbubemismith gbubemismith left a comment

Choose a reason for hiding this comment

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

This looks good

@vvolkgang vvolkgang changed the title Set push token on login [SG-823] Set push token on login Nov 18, 2022
@trmartin4 trmartin4 closed this Nov 21, 2022
@vvolkgang vvolkgang deleted the SG-816-add-push-token branch June 20, 2024 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants