Enhance debug logging for Passkey Registration options
Some checks failed
Code Analysis (JS/Vue) / analyze (push) Failing after 44s
Some checks failed
Code Analysis (JS/Vue) / analyze (push) Failing after 44s
Add detailed debug statements in the registrieren.vue component to validate the complete options structure during Passkey registration. Update the register-passkey API to simplify the options return process, eliminating unnecessary serialization while maintaining comprehensive logging of the options details for improved troubleshooting.
This commit is contained in:
@@ -443,6 +443,28 @@ const handleRegisterWithPasskey = async () => {
|
|||||||
console.error('[DEBUG] Options missing challenge:', JSON.stringify(pre.options, null, 2))
|
console.error('[DEBUG] Options missing challenge:', JSON.stringify(pre.options, null, 2))
|
||||||
throw new Error('Ungültige WebAuthn-Options vom Server')
|
throw new Error('Ungültige WebAuthn-Options vom Server')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Debug: Prüfe die vollständige Options-Struktur
|
||||||
|
console.log('[DEBUG] Full options structure check:', {
|
||||||
|
hasChallenge: !!pre.options.challenge,
|
||||||
|
challengeValue: pre.options.challenge?.substring(0, 20) + '...',
|
||||||
|
challengeType: typeof pre.options.challenge,
|
||||||
|
hasRp: !!pre.options.rp,
|
||||||
|
rpId: pre.options.rp?.id,
|
||||||
|
rpName: pre.options.rp?.name,
|
||||||
|
hasUser: !!pre.options.user,
|
||||||
|
userId: pre.options.user?.id ? 'present' : 'missing',
|
||||||
|
userIdType: typeof pre.options.user?.id,
|
||||||
|
userName: pre.options.user?.name,
|
||||||
|
userDisplayName: pre.options.user?.displayName,
|
||||||
|
hasPubKeyCredParams: !!pre.options.pubKeyCredParams,
|
||||||
|
pubKeyCredParamsCount: pre.options.pubKeyCredParams?.length,
|
||||||
|
hasAuthenticatorSelection: !!pre.options.authenticatorSelection,
|
||||||
|
timeout: pre.options.timeout,
|
||||||
|
timeoutType: typeof pre.options.timeout,
|
||||||
|
allKeys: Object.keys(pre.options),
|
||||||
|
optionsStringified: JSON.stringify(pre.options).substring(0, 200) + '...'
|
||||||
|
})
|
||||||
|
|
||||||
console.log('[DEBUG] Calling startRegistration...')
|
console.log('[DEBUG] Calling startRegistration...')
|
||||||
console.log('[DEBUG] Full options object (will be encoded in QR code for Cross-Device):', JSON.stringify(pre.options, null, 2))
|
console.log('[DEBUG] Full options object (will be encoded in QR code for Cross-Device):', JSON.stringify(pre.options, null, 2))
|
||||||
|
|||||||
@@ -142,24 +142,21 @@ export default defineEventHandler(async (event) => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stelle sicher, dass die Options korrekt serialisiert werden
|
// Options direkt zurückgeben (wie in passkeys/registration-options.post.js)
|
||||||
const serializedOptions = {
|
// @simplewebauthn/server gibt bereits korrekt formatierte Options zurück
|
||||||
...options,
|
|
||||||
challenge: options.challenge,
|
|
||||||
rp: options.rp,
|
|
||||||
user: options.user,
|
|
||||||
pubKeyCredParams: options.pubKeyCredParams,
|
|
||||||
authenticatorSelection: options.authenticatorSelection,
|
|
||||||
timeout: options.timeout || 300000
|
|
||||||
}
|
|
||||||
|
|
||||||
const totalDuration = Date.now() - requestStart
|
const totalDuration = Date.now() - requestStart
|
||||||
console.log(`[DEBUG] Returning options (total: ${totalDuration}ms)`, {
|
console.log(`[DEBUG] Returning options (total: ${totalDuration}ms)`, {
|
||||||
registrationId,
|
registrationId,
|
||||||
optionsKeys: Object.keys(serializedOptions),
|
optionsKeys: Object.keys(options),
|
||||||
serializedChallengeLength: serializedOptions.challenge?.length
|
challengeLength: options.challenge?.length,
|
||||||
|
challengeType: typeof options.challenge,
|
||||||
|
rpId: options.rp?.id,
|
||||||
|
userIdType: typeof options.user?.id,
|
||||||
|
timeout: options.timeout
|
||||||
})
|
})
|
||||||
|
|
||||||
return { success: true, registrationId, options: serializedOptions }
|
// WICHTIG: Options direkt zurückgeben, keine manuelle Serialisierung
|
||||||
|
// Die Options von @simplewebauthn/server sind bereits korrekt formatiert
|
||||||
|
return { success: true, registrationId, options }
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user