From cdf2035433eb355b707b9f1c764636e69cc87a2c Mon Sep 17 00:00:00 2001 From: maximilize <3752128+maximilize@users.noreply.github.com> Date: Mon, 23 Nov 2026 03:52:37 +0300 Subject: [PATCH] Do not fail login when push device registration fails (#7378) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit register_push_device() runs on re-authentication of an existing device in authenticated_response(). Its error was propagated with `?`, so a failure talking to the push relay/identity server (e.g. an undecodable response in get_auth_api_token(), "Unexpected push token received from bitwarden server") turned a successful authentication into a 400 Bad Request on POST /identity/connect/token. Handle the registration best-effort instead: log the error and continue, mirroring the new-device login email handling a few lines above. The device is still saved afterwards, and a re-login no longer fails when the push relay/identity endpoint misbehaves. Fixes #7371 Co-authored-by: max Co-authored-by: Daniel GarcĂ­a --- src/api/identity.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/api/identity.rs b/src/api/identity.rs index c359e632..ac9d28cc 100644 --- a/src/api/identity.rs +++ b/src/api/identity.rs @@ -606,7 +606,12 @@ async fn authenticated_response( // register push device if !device.is_new() { - register_push_device(device, conn).await?; + // Registering the device for push is best-effort: a failure talking to the + // push relay/identity server must not turn a successful authentication into + // an error (see #7371). This mirrors the new-device email handling above. + if let Err(e) = register_push_device(device, conn).await { + error!("An error occurred while registering the device for push notifications: {e}"); + } } // Save to update `device.updated_at` to track usage and toggle new status