From 226c78a64aa1e868c4b87b4de7ca7dc3c1c6e1f5 Mon Sep 17 00:00:00 2001 From: Jakob Wennberg <149234542+jakobwennberg@users.noreply.github.com> Date: Wed, 8 Apr 2026 14:01:55 +0200 Subject: [PATCH] fix: use redirect=null for mobile BankID to prevent new tab (#194) Previously the mobile deep link used the current URL as redirect, causing BankID to open a new browser tab after auth instead of returning to the original. Now uses redirect=null so the user switches back manually and the polling picks up completion. Co-authored-by: Claude Opus 4.6 (1M context) --- components/auth/BankIdAuth.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/auth/BankIdAuth.tsx b/components/auth/BankIdAuth.tsx index 313a2070..11d8bef6 100644 --- a/components/auth/BankIdAuth.tsx +++ b/components/auth/BankIdAuth.tsx @@ -88,10 +88,10 @@ export function BankIdAuth({ mode, onComplete }: BankIdAuthProps) { const newSession: BankIdSession = data setSession(newSession) - // On mobile, open BankID app + // On mobile, open BankID app — redirect=null so it doesn't open a new tab; + // the polling in this tab detects completion when the user switches back. if (isMobile()) { - const returnUrl = encodeURIComponent(window.location.href) - window.location.href = `bankid:///?autostarttoken=${newSession.autoStartToken}&redirect=${returnUrl}` + window.location.href = `bankid:///?autostarttoken=${newSession.autoStartToken}&redirect=null` } // Start polling