npm install auth0-guardian-js
Source files
Configure Guardian
requestToken
or ticket
depends on the authentication method. Ticket corresponds to a previously generated enrollment ticket.
Use a custom domain
If you have a configured for your Auth0 tenant, you’ll need to update theserviceUrl
property to point to the Guardian endpoint:
Enroll devices
Enrolling devices consists of the following steps:- Start the transaction.
- (optional) Check if the user is already enrolled. You cannot enroll twice.
- Send the information needed to enroll.
- Confirm enrollment.
- Show the recovery code.
enrollment-complete
event.
Authenticate
To authenticate with a method you need to execute the following steps:- Start the transaction.
- (optional) Check if the user is already enrolled. You need to be enrolled to authenticate.
- Request the auth (the push notification or SMS). Request is a noop for OTP.
- Verify the OTP (
.verify
is a noop for push).
auth-response
event with the payload to send to the server, you can use the auth0GuardianJS.formPostHelper('{{ postActionURL }}', payload)
to post back the message to the server.
You may also receive auth-rejected
if the push notification was received.