Enhance passkey registration handling with error checks and CORS support
Some checks failed
Code Analysis (JS/Vue) / analyze (push) Failing after 49s
Some checks failed
Code Analysis (JS/Vue) / analyze (push) Failing after 49s
Add validation for server response in the registration process, ensuring the presence of necessary options. Implement CORS headers for cross-device authentication and increase the timeout for registration to 5 minutes. Include debug logging for options structure to aid in troubleshooting.
This commit is contained in:
@@ -334,7 +334,19 @@ const handleRegisterWithPasskey = async () => {
|
||||
}
|
||||
})
|
||||
|
||||
if (!pre.success || !pre.options) {
|
||||
throw new Error('Ungültige Antwort vom Server')
|
||||
}
|
||||
|
||||
// Debug: Prüfe Options-Struktur
|
||||
if (!pre.options.challenge) {
|
||||
console.error('Options fehlen challenge:', pre.options)
|
||||
throw new Error('Ungültige WebAuthn-Options vom Server')
|
||||
}
|
||||
|
||||
const mod = await import('@simplewebauthn/browser')
|
||||
// startRegistration erwartet die Options direkt, nicht verschachtelt
|
||||
// @simplewebauthn/browser v13+ erwartet die Options direkt
|
||||
const credential = await mod.startRegistration(pre.options)
|
||||
|
||||
const response = await $fetch('/api/auth/register-passkey', {
|
||||
|
||||
Reference in New Issue
Block a user