Enhance debug logging for Passkey Registration requests
Some checks failed
Code Analysis (JS/Vue) / analyze (push) Failing after 51s
Some checks failed
Code Analysis (JS/Vue) / analyze (push) Failing after 51s
Improve logging in the register-passkey-options and log-requests middleware to provide detailed insights into request handling. Add user-agent analysis, IP address logging, and mobile/desktop detection to aid in troubleshooting. This update aims to enhance the clarity of request logs and support better debugging during the Passkey registration process.
This commit is contained in:
@@ -26,16 +26,32 @@ export default defineEventHandler((event) => {
|
||||
|
||||
if (isPasskeyEndpoint) {
|
||||
const timestamp = new Date().toISOString()
|
||||
const isMobile = /Mobile|Android|iPhone|iPad/i.test(userAgent || '')
|
||||
|
||||
console.log('')
|
||||
console.log('─'.repeat(80))
|
||||
console.log(`[REQUEST] ${timestamp} ${method} ${path}`)
|
||||
console.log(`[REQUEST] Origin: ${origin || 'none'}`)
|
||||
console.log(`[REQUEST] IP: ${ip}`)
|
||||
console.log(`[REQUEST] User-Agent: ${userAgent?.substring(0, 100) || 'none'}`)
|
||||
console.log(`[REQUEST] User-Agent: ${userAgent?.substring(0, 150) || 'none'}`)
|
||||
console.log(`[REQUEST] Is Mobile: ${isMobile ? '✅ JA' : '❌ NEIN'}`)
|
||||
|
||||
// Spezielle Logs für Cross-Device
|
||||
if (path.includes('register-passkey')) {
|
||||
console.log(`[REQUEST] 🔑 PASSKEY REQUEST - ${method} ${path}`)
|
||||
console.log(`[REQUEST] ⚠️ Wenn dieser Request vom Smartphone kommt, sollte der User-Agent Mobile/Android/iPhone enthalten`)
|
||||
console.log(`[REQUEST] ⚠️ Wenn dieser Request NICHT kommt, erreicht das Smartphone den Server nicht`)
|
||||
if (path.includes('register-passkey') && method === 'POST') {
|
||||
console.log(`[REQUEST] 🔑 PASSKEY REGISTRATION REQUEST`)
|
||||
if (isMobile) {
|
||||
console.log(`[REQUEST] ✅ Request kommt vom Smartphone!`)
|
||||
} else {
|
||||
console.log(`[REQUEST] ⚠️ Request kommt NICHT vom Smartphone (Desktop-Browser?)`)
|
||||
}
|
||||
}
|
||||
|
||||
if (path.includes('register-passkey') && method === 'OPTIONS') {
|
||||
console.log(`[REQUEST] 🔧 OPTIONS Preflight für Passkey Registration`)
|
||||
console.log(`[REQUEST] ⚠️ Wenn dieser Request vom Smartphone kommt, sollte der User-Agent Mobile/Android/iPhone enthalten`)
|
||||
}
|
||||
|
||||
console.log('─'.repeat(80))
|
||||
console.log('')
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user