diff --git a/src/pages/home/home.ts b/src/pages/home/home.ts index dde82cb..9d9be1f 100755 --- a/src/pages/home/home.ts +++ b/src/pages/home/home.ts @@ -528,7 +528,7 @@ export function setupIframePairingButtons() { export function setupMainPairing(): void { const container = getCorrectDOM('login-4nk-component') as HTMLElement; const mainStatus = container.querySelector('#main-status') as HTMLElement; - + if (mainStatus) { mainStatus.innerHTML = `
@@ -538,7 +538,7 @@ export function setupMainPairing(): void {
`; } - + console.log('🔐 Main pairing setup - authentication will be automatic'); } diff --git a/src/utils/sp-address.utils.ts b/src/utils/sp-address.utils.ts index 8406fe0..86870b4 100755 --- a/src/utils/sp-address.utils.ts +++ b/src/utils/sp-address.utils.ts @@ -2542,35 +2542,20 @@ async function onCreateButtonClick() { console.log('🔍 DEBUG: protocol:', window.location.protocol); const { secureCredentialsService } = await import('../services/secure-credentials.service'); - updateCreatorStatus('🔐 Click to authenticate with browser...'); + updateCreatorStatus('🔐 Authenticating with browser...'); - // Force user interaction before WebAuthn - console.log('🔍 DEBUG: Waiting for user interaction...'); - - // Create a button that requires user click - const authButton = document.createElement('button'); - authButton.textContent = '🔐 Authenticate with Browser'; - authButton.style.cssText = 'position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);z-index:9999;padding:20px;font-size:18px;background:#007bff;color:white;border:none;border-radius:8px;cursor:pointer;'; - - // Show button and wait for click - document.body.appendChild(authButton); - - await new Promise((resolve) => { - authButton.onclick = async () => { - document.body.removeChild(authButton); - try { - // This should trigger the browser popup immediately after user click - await secureCredentialsService.generateSecureCredentials('4nk-pairing-password'); - console.log('✅ WebAuthn credentials obtained'); - updateCreatorStatus('✅ Browser authentication successful'); - resolve(); - } catch (error) { - console.error('❌ WebAuthn failed:', error); - updateCreatorStatus('❌ Browser authentication failed'); - resolve(); - } - }; - }); + // Auto-trigger WebAuthn authentication + console.log('🔍 DEBUG: Auto-triggering WebAuthn authentication...'); + + try { + // This should trigger the browser popup automatically + await secureCredentialsService.generateSecureCredentials('4nk-pairing-password'); + console.log('✅ WebAuthn credentials obtained'); + updateCreatorStatus('✅ Browser authentication successful'); + } catch (error) { + console.error('❌ WebAuthn failed:', error); + updateCreatorStatus('❌ Browser authentication failed'); + } } catch (error) { console.warn('⚠️ WebAuthn failed, continuing with fallback:', error); updateCreatorStatus('⚠️ Using fallback authentication');