View Source WebauthnComponents.AuthenticationComponent (WebauthnComponents v0.3.1)
A LiveComponent for authentication via WebAuthn API.
Authentication = Sign In
Authentication is the process of matching a registered key to an existing user.
See USAGE.md for example code.
assigns
Assigns
@challenge
: (Internal) AWax.Challenge
struct created by the component, used to request an existing credential in the client.@class
(Optional) CSS classes for overriding the default button style.@disabled
(Optional) Set totrue
when theSupportHook
indicates WebAuthn is not supported or enabled by the browser. Defaults tofalse
.@id
(Optional) An HTML element ID.
events
Events
"authenticate"
: Triggered when a user clicks theauthenticate
button."authentication-challenge"
: Sent from the component to the client to request an existing credential registered to the endpoint URL."authentication-attestation"
: Sent by the client when a credential has been registered to the endpoint URL and activated by the user."error"
Sent by the client when an error occurs.
messages
Messages
{:find_credentials, user_handle: user_handle}
user_handle
is a raw binary representing the user id or random id stored in the credential during registration.- The parent LiveView must successfully lookup the user with this data before storing a token and redirecting to another view.
{:error, payload}
payload
contains themessage
,name
, andstack
returned by the browser upon timeout or other client-side errors.
Errors should be displayed to the user via
Phoenix.LiveView.put_flash/3
. However, some errors may be too technical or cryptic to be useful to users, so the parent LiveView may paraphrase the message for clarity.
Link to this section Summary
Functions
Callback implementation for Phoenix.LiveComponent.handle_event/3
.
Callback implementation for Phoenix.LiveComponent.mount/1
.
Callback implementation for Phoenix.LiveComponent.render/1
.
Link to this section Functions
Callback implementation for Phoenix.LiveComponent.handle_event/3
.
Callback implementation for Phoenix.LiveComponent.mount/1
.
Callback implementation for Phoenix.LiveComponent.render/1
.