Only exactly one of 'password', 'federated', and 'publicKey' credential types are currently supported.
Whip opened this issue · comments
Vipul Kapoor commented
I followed your _test code to create a new registration. The request is sent to the server and I get this response back
But then I get error from navigator.credentials.create()
- Only exactly one of 'password', 'federated', and 'publicKey' credential types are currently supported.
Here's my code:
G.ajax({
type: 'POST',
data: {
action: 'newRegistration',
name: nameField.value,
email: emailField.value
}
}).then(data => {
console.log(JSON.parse(data.responseText)); // output posted above as screenshot
const publicKeyCredentialCreationOptions = recursiveBase64StrToArrayBuffer(JSON.parse(data.responseText));
navigator.credentials.create(publicKeyCredentialCreationOptions).then(response => {
console.log(response);
}).catch(err => {
console.log(err);
});
}).catch(xhr => {
console.log('Failed', xhr);
handleError('Request timed out or was denied. Tap Sign in again to start over');
});
What is the reason for this? Is my JSON wrong?
Lukas commented
Do you use the recursiveBase64StrToArrayBuffer
function from my example?
It does not have a response, it takes a reference of a object and modifies it:
const publicKeyCredentialCreationOptions = JSON.parse(data.responseText);
recursiveBase64StrToArrayBuffer(publicKeyCredentialCreationOptions);
navigator.credentials.create(publicKeyCredentialCreationOptions).then(.........
Vipul Kapoor commented
That's it. It worked. Thanks a bunch.