Enhance debug logging and Cross-Device support for Passkey Registration
Some checks failed
Code Analysis (JS/Vue) / analyze (push) Failing after 45s

Update the registrieren.vue component to include detailed debug statements for the Cross-Device authentication flow, specifically during QR-Code generation. Improve logging in the register-passkey-options and register-passkey APIs to capture request details such as user agent and IP address, aiding in troubleshooting. Additionally, introduce a new function to retrieve pre-registration data, enhancing the overall registration process and compliance with Cross-Device requirements.
This commit is contained in:
Torsten Schulz (local)
2026-01-08 23:27:11 +01:00
parent badf91afef
commit 29ef644581
7 changed files with 174 additions and 11 deletions

View File

@@ -15,16 +15,27 @@ export default defineEventHandler(async (event) => {
const userAgent = getHeader(event, 'user-agent')
const { origin: webauthnOrigin } = getWebAuthnConfig()
console.log('[DEBUG] ===== register-passkey request received =====')
console.log('')
console.log('='.repeat(80))
console.log('[DEBUG] 🔑 ===== PASSKEY REGISTRATION REQUEST RECEIVED =====')
console.log('='.repeat(80))
console.log('[DEBUG] Request Details:', {
origin: requestOrigin,
origin: requestOrigin || 'none',
webauthnOrigin,
userAgent: userAgent?.substring(0, 150),
userAgent: userAgent?.substring(0, 150) || 'none',
timestamp: new Date().toISOString(),
method: getMethod(event),
ip: getClientIp(event),
note: 'Dieser Request sollte vom Smartphone kommen, wenn der QR-Code gescannt wurde'
url: getRequestURL(event).href,
path: getRequestURL(event).pathname
})
console.log('[DEBUG] ⚠️ WICHTIG: Dieser Request sollte vom Smartphone kommen, wenn der QR-Code gescannt wurde')
console.log('[DEBUG] ⚠️ Wenn dieser Request NICHT im Log erscheint, bedeutet das:')
console.log('[DEBUG] 1. Das Smartphone konnte die Website nicht erreichen')
console.log('[DEBUG] 2. Oder startRegistration auf dem Smartphone ist fehlgeschlagen')
console.log('[DEBUG] 3. Oder die Credential-Response wurde nicht gesendet')
console.log('='.repeat(80))
console.log('')
console.log('[DEBUG] User-Agent Analysis:', {
isMobile: /Mobile|Android|iPhone|iPad/i.test(userAgent || ''),
isChrome: /Chrome/i.test(userAgent || ''),