-
Notifications
You must be signed in to change notification settings - Fork 32
Update to clarify Actions examples #399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
5a0115f
ae61eb7
8e958a5
34679e2
2853984
00012f1
30d7bb0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -615,7 +615,14 @@ Auth0 provides two Action templates based on Adaptive MFA for you to customize: | |||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ### Adaptive MFA template | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| This template provides an example and starting point for how to build a custom business flow using individual risk assessments. | ||||||||||||||||||||||||||||||
| This template provides an example and starting point for how to build a custom business flow using individual risk assessments. In this example, we use: | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| * The [`api.multifactor.enable`](/docs/customize/actions/explore-triggers/signup-and-login-triggers/login-trigger/post-login-api-object#api-multifactor) Action trigger to handle both enrollment and issues configured MFA challenges at the end of the login flow. | ||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||
| * The [`event.user.multifactor`](/docs/customize/actions/explore-triggers/signup-and-login-triggers/login-trigger/post-login-event-object) Actions trigger with the user's enrolled factors. | ||||||||||||||||||||||||||||||
|
Comment on lines
+620
to
+621
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "Actions trigger" or "Action trigger"? (not sure which one is the right way to refer to the product) |
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| <Callout icon="file-lines" color="#0EA5E9" iconType="regular"> | ||||||||||||||||||||||||||||||
| Since `email` notifications are not an independent factor, the condition `const canPromptMfa = event.user.multifactor && event.user.multifactor.length > 0;` will return `false` if the user only has `email` as a factor. To learn more, read [Configure Email Notifications for MFA](/docs/secure/multi-factor-authentication/multi-factor-authentication-factors/configure-email-notifications-for-mfa). | ||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||
| </Callout> | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ```javascript lines expandable | ||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||
|
|
@@ -660,6 +667,17 @@ exports.onExecutePostLogin = async (event, api) => { | |||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| To prompt users, replace the `api.multifactor.enable` with `api.authentication.challengeWithAny()` to force an MFA challenge with an existing factor the user has already enrolled. To review supported factors with Actions, read about the [`factors` parameter](https://auth0.com/docs/customize/actions/explore-triggers/signup-and-login-triggers/login-trigger/post-login-api-object#api-authentication-challengewithany-factors). For example: | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| ``` javascript | ||||||||||||||||||||||||||||||
| // It only makes sense to prompt for MFA when the user has at least one | ||||||||||||||||||||||||||||||
| // enrolled MFA factor. | ||||||||||||||||||||||||||||||
| const canPromptMfa = event.user.enrolledFactors && event.user.enrolledFactors.length >0; | ||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this change also uses |
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| if (shouldPromptMfa && canPromptMfa) { | ||||||||||||||||||||||||||||||
| api.authentication.challengeWithAny([ {type: "email"}, {type:"phone"} ]); | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
Comment on lines
+673
to
+679
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.