/** * Interim "finalizing" page for the Enable Banking OAuth callback. * * The callback has seconds of unavoidable server work between the bank's * redirect and our own (session exchange with Enable Banking, account * mirroring, audit events). A classic 307 would leave the user staring at a * blank browser tab for that whole window, which reads as "the connection * failed" and provokes retries (and, historically, duplicate connections). * * Instead the route streams this page in two chunks: * 1. renderFinalizeShell() - flushed immediately, before any slow work: * branded spinner + "Slutför anslutningen". * 2. renderFinalizeRedirect() - flushed when the work is done: script + * meta-refresh + visible fallback link that * navigates to the settings page. * * The page is standalone HTML (no app bundle), styled to match the editorial * monochrome design system; see app/api/mcp-oauth/authorize for the sibling * standalone page this mirrors. Swedish-only, like the rest of the * enable-banking extension surfaces. * * Inline scripts are nonce-bound (ASVS V3.3): the route generates a * per-request nonce, stamps it on every ` } /** * Closing chunk: navigates to `url` the instant it arrives. Three mechanisms, * most graceful first: location.replace (keeps the callback URL out of * history so Back cannot re-trigger it), a meta refresh for no-JS, and a * visible link as the last resort. */ export function renderFinalizeRedirect(url: string, cspNonce: string): string { // <-escape so a "" sequence can never terminate the block // early, even though our URLs are app-relative and query-encoded. const jsUrl = JSON.stringify(url).replace(/window.location.replace(${jsUrl});
Klicka här om du inte skickas vidare automatiskt
` }