首页 > 解决方案 > Webauthn - Windows Hello 身份验证器选择不起作用

问题描述

我只是在开发一个示例节点 js 应用程序来在 Windows 10 上玩 webauthn。

        challenge: challenge,
        rp: {
            name: "Example CORP",
            id  : "localhost"
        },
        user: {
            id: new Uint8Array(16),
            name: "jdoe@example.com",
            displayName: "John Doe"
        },
        pubKeyCredParams: [
            {
            type: "public-key",
            alg: -7
            }
        ],authenticatorSelection: {
            authenticatorAttachment: "platform" //cross-platform is working fine
        },
        timeout: 60000
        };
        const credential = navigator.credentials.create({
            publicKey: publicKey 
        });

我确实得到了以下错误,并且没有看到任何 Windows Hello 模式窗口。

login:32 publicKey.authenticatorSelection.userVerification was not set to any value in Web Authentication navigator.credentials.create() call. This defaults to 'preferred', which is probably not what you want. If in doubt, set to 'discouraged'. See https://chromium.googlesource.com/chromium/src/+/master/content/browser/webauth/uv_preferred.md for details

我还缺少任何其他参数吗?

——湿婆

标签: node.jswebauthnpassword-less

解决方案


您没有在对象中定义userVerification属性。authenticatorSelection

来自W3.org

userVerification为断言的有效用户验证要求:

设置为必需userVerification为真。

设置为不鼓励userVerification为假。

设置为首选 如果身份验证器能够进行用户验证,则userVerification设为 true。如果身份验证器无法进行用户验证,userVerification则设为 false。

authenticatorSelection: {
  authenticatorAttachment: "platform",
  userVerification: "required" 
},

推荐阅读