Bei*_*Dev 0 javascript dialog prompt mobile-website webauthn
我正在尝试与WebAuthn集成以进行用户身份验证。
下面是我目前使用的代码:
const credOptions = {
publicKey: {
rp: {
name: 'test inc',
id:'login.test.com'
},
user,
authenticatorSelection: {
authenticatorAttachment: 'platform',
requireResidentKey: true,
userVerification: 'preferred'
},
pubKeyCredParams: [
{
type: 'public-key',
alg: -7
}
],
attestation: 'direct',
timeout: 60000,
challenge
}
};
try {
const cred = await navigator.credentials.create(credOptions);
return cred;
} catch (e) {
console.log(e);
}
Run Code Online (Sandbox Code Playgroud)
Sign In --> EnrollDo you want to allow "login.com" to use FaceID
--> Do you want to allow "Paypal" to use FaceID?我尝试更改 Relying party( rp) 信息,credOptions但没有看到预期的结果。
任何人都可以请指导这是否可行。
不幸的是,这是一个无法自定义的操作系统级提示。这是WebAuthn API的一个共同的局限性-出现响应的浏览器和操作系统的情态动词navigator.credentials.create()和.get()无法通过JS,因为它们被认为是有意不暴露在网页出于安全原因,浏览器或操作系统本身的情况下进行处理来操纵。