atinux / nuxt-auth-utils

Add Authentication to Nuxt applications with secured & sealed cookies sessions.
MIT License
973 stars 91 forks source link

webauthn defineWebAuthnRegisterEventHandler error in dev mode with https #271

Open germsb opened 2 weeks ago

germsb commented 2 weeks ago

Hello,

I get an error in the defineWebAuthnRegisterEventHandler

validateUser
validateUser ok {
  "userName": "xxxxx@gmail.com"
}
excludeCredentials
{ id: '480465be-c7fc-4b15-b277-21e03805bf9a', webauthn: null }
excludeCredentials ok [
  null
]
storeChallenge
storeChallenge ok
validateUser
validateUser ok {
  "userName": "xxxxx@gmail.com"
}
getChallenge
getChallenge ok bC5Poq9lx6gXrOlZXGF-bSbMQSkcziq9-X7w2mVWQsU

ERROR  [nuxt] [request error] [unhandled] [500] Unexpected registration response origin "https://localhost:3000", expected "http://localhost:3000"

//nuxt.config

{
//...
devServer: {
        https: {
            cert: 'cert/mydomain+1.pem',
            key: 'cert/mydomain+1-key.pem'
        }
    },
//...
}

//package.json "dev": "nuxt dev --host ",

Maybe related with the H3 getRequestProtocol(event) / getRequestProtocol(event, {xForwardedProto: true}) which always returns http !? #https://github.com/nuxt/cli/issues/324 #https://github.com/nuxt/nuxt/issues/25108 #https://github.com/nuxt/cli/issues/487