post-login
Actions, you can customize your flows to prompt users to enroll in specific factors. After a user enrolls in a factor, they can use that factor as a secondary method of authentication in future logins.
You can also use contextual information to further customize your MFA enrollment flows. For example, you can prompt users to enroll in SMS for one application while prompting them to enroll in push notifications or WebAuthN for a different application.
This feature allows you to customize your MFA enrollment flows. If you want to customize MFA flows for users who are already enrolled, review Customize MFA Selection for Universal Login.
post-login
trigger of the Login Flow with the following Authentication API methods:
enrollWith
: Specifies the default factor presented to users during enrollment. Optionally, you can provide an alternative list of factors for users to choose from. If provided, a Try Another Method link displays on the enrollment prompt.
enrollWithAny
: Specifies a set of factors users can choose from during enrollment. By default, this method presents a selection prompt that allows users to choose their desired factor. In some cases, the user experience may vary:
otp
recovery-code
push-notification
phone
preferredMethod: voice
preferredMethod: sms
preferredMethod: both
webauthn-platform
webauthn-roaming
enrolledFactors
. This property represents the list of active factors associated with their user account.
The array event.authentication.methods
includes a type
field when the name of the method is set to mfa
. This field contains factor values (string) that match those used by the type
field from enrolledFactors
.
When an MFA enrollment occurs, methods
contains the object of name:mfa
with type
set to the factor used for that event. methods
and enrolledFactors
are only updated when an Action first begins. You can access the results of an enrollment event in the next Action of the flow.
To learn more, review the following resources:
enrollWith
or enrollWithAny
commands, you can use contextual information to determine the best enrollment or series of enrollments to present to users.
enrollWith
command supports an initial or default factor and a list of alternatives. Users can only enroll in one factor per command.enrollWithAny
command supports a list of factors. The specified order of factors determines how the list displays to users. Users can only enroll in one factor per command.app_metadata
to determine if the user is an admin, then prompts them to enroll in specific factors. If an admin user has only enrolled in OTP, they are first challenged with OTP to complete their authentication. They are then prompted to enroll with security keys (webauthn-roaming
).
event.user.enrolledFactors
and event.authentication.methods
will be updated when Action 2 runs. This allows the Action code to make decisions based on actual user data when users are given a choice to challenge or enroll in different factors.
Note: This method of executing Actions only applies to those containing enrollWith
or enrollWithAny
commands. Actions serving other purposes are not affected.
enrollWith
or enrollWithAny
commands override any existing policies or rules that enable or disable MFA in a tenant.
post-login
Actions to customize your MFA enrollment flows.
enrollWith
enrollWithAny
challengeWith
challengeWithAny
onPostExecute
command.
Scenario | Event | Error Message |
---|---|---|
A user is prompted to enroll with a specific factor. However, the requested factor meets one of the following conditions:
| w | An MFA enrollment is used in a PostLogin action, but the requested factor $ is not properly set up. Enable the requested factor and ensure the user is not already enrolled with it. |
A user is prompted to enroll with one or more factors, but the supplied factors cannot be used for enrollment. In this case, the user cannot complete the flow. | mfar | An MFA enrollment is used in a PostLogin action but the requested factors are not properly set up. To perform MFA, enable the requested factors and ensure the user is not already enrolled with them. |
A user attempts to enroll in a new factor without completing at least one challenge using an existing enrollment. | mfar | An MFA enrollment was requested but the user is already enrolled in MFA. Challenge with at least one existing factor before enrolling a new one. |
post-login
Actions.
post-login
Actions for deployment when using the Deploy CLI. For more information, review Configure the Deploy CLI.