7

I am trying to setup webauthn credential login for web app. I am testing it on last Android (Pixel 2) and latest Chrome for Android.

I can create and send credential object with function navigator.credentials.create({publicKey}). Key is created with internal fingerprint sensor or better android-safetynet.

When I want to get this key with navigator.credentials.get({publicKey}) I always get error: "NotAllowedError: The operation either timed out or was not allowed. See: https://www.w3.org/TR/webauthn-2/#sctn-privacy-considerations-client." I found nothing useful for this error so far.

Code sample where error is catched:

const base64Id = 'Ej_1cfBcad6TVO1choHVQl';
const bufferId = Buffer.from(base64Id, 'base64');

const randomChallenge = crypto.randomBytes(32);
const bufferChallenge = Buffer.from(randomChallenge, 'base64');

const options = {
  challenge: bufferChallenge,
  timeout: 60000,
  allowCredentials: [
    {
      transports: ['internal'],
      type: 'public-key',
      id: bufferId
    },
  ],
};

navigator.credentials
  .get({ publicKey: options })
  .then((credentialInfoAssertion) => {
    alert(credentialInfoAssertion.toString());
  })
  .catch((err) => {
    alert(err.toString());
  });

Calling get credential result in error, expected result is getting credential (like that credential which I get from .create method).

I tested some demo sites with webauthn and it was working, so browser support is no problem.

Thank you

beliaban
  • 83
  • 4

0 Answers0