Occasional NotSupportedError exception using WebAuthn
Asked Answered
A

0

0

We use WebAuthn. Although, some devices throw exceptions NotSupportedError: The user agent does not support public key credentials.

Here is how we check if platform auth feature is available:

async function isWebAuthn() {
    return Boolean(
        navigator.credentials &&
        navigator.credentials.create &&
        navigator.credentials.get &&
        self.PublicKeyCredential &&
        self.PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable &&
        await self.PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()
    );
}

We see at least two devices which throw exceptions every time we try calling navigator.credentials.create().

  • Mozilla/5.0 (Linux; Android 9; ONEPLUS A3003) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.136 Mobile Safari/537.36
  • Mozilla/5.0 (Linux; Android 9; LG-H930) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.116 Mobile Safari/537.36

Here is the call:

await navigator.credentials.create({
    publicKey: {
        authenticatorSelection: {
            authenticatorAttachment: "platform",
            requireResidentKey: false,
            userVerification: "required"
        },
        challenge: challenge,
        rp: { id: document.domain, name: name },
        user: {
            id: id,
            name: name,
            displayName: displayName
        },
        pubKeyCredParams: [
            { type: "public-key", alg: -7 },
            { type: "public-key", alg: -257 }
        ]
    }
});

How to avoid browser throwing that exception?

Anglicanism answered 27/1, 2020 at 22:17 Comment(3)
were you able to fix this?Retrusion
nope. Still receiving.Anglicanism
2024 - is this fixed?Kuster

© 2022 - 2024 — McMap. All rights reserved.