Javascript
Examples for dynamic interactions
Installation
npm i @web-auth/webauthn-helper
#or
yarn add @web-auth/webauthn-helperRegistration
// Import the registration hook
import {useRegistration} from '@web-auth/webauthn-helper';
// Create your register function.
// By default the urls are "/register" and "/register/options"
// but you can change those urls if needed.
const register = useRegistration({
actionUrl: '/api/register',
optionsUrl: '/api/register/options'
});
// We can call this register function whenever we need (e.g. form submission)
register({
username: 'john.doe',
displayName: 'JD'
})
.then((response) => console.log('Registration success'))
.catch((error) => console.log('Registration failure'))
;Authentication
Last updated
Was this helpful?