Learn how to use the Authsignal React SDK.
An example of the UI components in a checkout flow.
AuthsignalProvider
component allows you to use the useAuthsignal hook. Render the AuthsignalProvider
component
at the root of your application so that it is available everywhere you need it.
AuthsignalProvider
component accepts the following props:
useAuthsignal
hook returns two functions, startChallenge
and startChallengeAsync
, that you can use to
trigger the authentication flow.
Both functions require a token
to be passed as an argument. The token
should be
returned by your server after tracking an action.
startChallenge
startChallenge
function triggers the authentication flow.
token
, the startChallenge
function accepts the following callbacks:
token
property. This token
should be sent to your server to validate the
challenge.startChallengeAsync
startChallengeAsync
function, which returns a Promise
that resolves with a token
when the challenge is successful.
It will throw a ChallengeError
if the user cancels the challenge or the token expires.
appearance
prop to the AuthsignalProvider component.