Browse Source

fix: webauthn cannot register #753

Jacky 5 months ago
parent
commit
6abf68261c
2 changed files with 3 additions and 3 deletions
  1. 1 1
      api/user/passkey.go
  2. 2 2
      app/src/views/preference/components/AddPasskey.vue

+ 1 - 1
api/user/passkey.go

@@ -45,7 +45,7 @@ func BeginPasskeyRegistration(c *gin.Context) {
 	}
 	cache.Set(buildCachePasskeyRegKey(u.ID), sessionData, passkeyTimeout)
 
-	c.JSON(http.StatusOK, options)
+	c.JSON(http.StatusOK, options.Response)
 }
 
 func FinishPasskeyRegistration(c *gin.Context) {

+ 2 - 2
app/src/views/preference/components/AddPasskey.vue

@@ -15,9 +15,9 @@ const regLoading = ref(false)
 async function registerPasskey() {
   regLoading.value = true
   try {
-    const options = await passkey.begin_registration()
+    const optionsJSON = await passkey.begin_registration()
 
-    const attestationResponse = await startRegistration(options.publicKey)
+    const attestationResponse = await startRegistration({ optionsJSON })
 
     await passkey.finish_registration(attestationResponse, passkeyName.value)