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) <noreply@anthropic.com>
This commit is contained in:
Jakob Wennberg
2026-04-08 14:01:55 +02:00
committed by GitHub
co-authored by Claude Opus 4.6
parent 6d75b9a1bf
commit 226c78a64a
+3 -3
View File
@@ -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