26 lines
586 B
JavaScript
26 lines
586 B
JavaScript
fetch('/users/generate-auth-options/arthur')
|
|
.then(resp => resp.json())
|
|
.then((optionsJSON) => {
|
|
console.log(optionsJSON);
|
|
return SimpleWebAuthnBrowser.startAuthentication({ optionsJSON })
|
|
})
|
|
.then(authResp => {
|
|
console.log("verify");
|
|
return fetch("/users/verify-auth", {
|
|
method: "POST",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
},
|
|
body: JSON.stringify({
|
|
authResp: authResp,
|
|
username: "arthur"
|
|
})
|
|
});
|
|
})
|
|
.then(res => {
|
|
console.log(res);
|
|
})
|
|
.catch(err => {
|
|
console.error(err);
|
|
});
|