1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-14 07:23:45 +00:00

fix(redirect): [PM-26578] Https Redirection for Cloud Users - Fixed deeplinkScheme being used for webauthn.

This commit is contained in:
Patrick Pimentel
2026-02-02 17:43:57 -05:00
parent ce0e7884b4
commit 5348d301d0

View File

@@ -1,8 +1,10 @@
// FIXME: Update this file to be type safe and remove this and next line
// @ts-strict-ignore
import { b64Decode, getQsParam } from "./common";
import { b64Decode, buildMobileDeeplinkUriFromParam, getQsParam } from "./common";
import { buildDataString, parseWebauthnJson } from "./common-webauthn";
const mobileCallbackUri = "bitwarden://webauthn-callback";
let parsed = false;
let webauthnJson: any;
let headerText: string = null;
@@ -124,7 +126,7 @@ function parseParametersV2() {
headerText: string;
btnText: string;
btnReturnText: string;
callbackUri?: string;
mobile?: boolean;
} = null;
try {
dataObj = JSON.parse(b64Decode(getQsParam("data")));
@@ -135,8 +137,15 @@ function parseParametersV2() {
return;
}
// Use optional callbackUri to indicate deep-link return; otherwise we will use postMessage to parent
callbackUri = dataObj.callbackUri ?? null;
// Determine callback URI for mobile deep-link return
// Priority: 1) deeplinkScheme query param, 2) mobile flag with hardcoded URI
const deeplinkScheme = getQsParam("deeplinkScheme");
if (deeplinkScheme) {
callbackUri = buildMobileDeeplinkUriFromParam("webauthn");
} else if (dataObj.mobile === true) {
callbackUri = mobileCallbackUri;
}
webauthnJson = dataObj.data;
headerText = dataObj.headerText;
btnText = dataObj.btnText;