Open
Description
For some reason, I'm getting this error on login from navigator.credentials.create
. This happen sometimes and for some accounts but not for others. Can you tell what is the reason/source of this error? Here's the code
try {
$WebAuthn = new lbuchs\WebAuthn\WebAuthn('Project Name', 'ProjectDomain', ['none']);
$createArgs = $WebAuthn->getCreateArgs($customer['id'], $email, $customer['name'], 120, 'required', 'required', null);
$challenge = $WebAuthn->getChallenge();
$_SESSION['login-challenge'] = [
'challenge' => $challenge->getBinaryString(),
'userId' => $customer['id'],
'email' => $email
];
echo json_encode([
'actionRequired' => 'newDevice',
'createArgs' => $createArgs
]);
} catch (Exception $e) {
echo '{"error":"'.$e->getMessage().'"}';
}
This response from php is provided to js
if(pubKeyCredOpts.actionRequired == 'newDevice'){
recursiveBase64StrToArrayBuffer(pubKeyCredOpts.createArgs);
navigator.credentials.create(pubKeyCredOpts.createArgs).then(cred => {
const publicKeyCredential = {
transports: cred.response.getTransports ? cred.response.getTransports() : null,
clientDataJSON: cred.response.clientDataJSON ? arrayBufferToBase64(cred.response.clientDataJSON) : null,
attestationObject: cred.response.attestationObject ? arrayBufferToBase64(cred.response.attestationObject) : null
};
// step 4 request
verifyCreds('NewDevice', publicKeyCredential);
}).catch(err => {
handleError(err); <- This is executed showing the error
});
}