post-login
) Trigger of the Login Flow. If you follow the steps below and keep your Actions in the same order as your original Rules, the functionality should be identical.
auth0
object as in Rules. To learn how Management API calls can still be made, read the Convert Code section.user
and context
objects on the Actions event
object. Look for any side effects your Actions have on the system (like failing a login or updating user metadata) in the api
object functions.onExecutePostLogin
function.
user
, context
, and callback
parameters, while Actions use a function exported to a specific name. Make the following change; for now, ignore any errors that appear.
Before
user
object. In Actions, this data is found in the user
property of the event
object. The majority of existing properties are accessible in this new location.
event
object are not accessible in other Actions.context
object. For Actions, this data has been reshaped and moved to the event
object. Many of the properties moved over as-is, but some have been combined to increase clarity.
event
object are not accessible in other Actions. If your Rule triggers core functionality by setting data on these properties, like context.idToken
or context.multifactor
, please read one of the sections below that addresses your use case.require
statement. Actions use a more standard CommonJS syntax and require that the versions be indicated outside of the code editor.
In Rules, only specific versions of specific packages are allowed, and adding new packages and versions requires a request to Auth0. In Actions, you can require any package that is available in the npm
Registry.
npm
modules are not on the latest version, this is a great time to get up to date!require
statements inside your Rule code.require
statements outside of the function
declaration:callback()
function and pass in an error if the login fails. Conversely, Actions can return on success, or call an api
method with a message if the login fails. All instances of callback()
in a Rule should be removed or replaced with api.access.deny()
for failure. In both Rules and Actions, if processing needs to stop for a specific condition, use a return
statement.
Before
context
object, while Actions uses a method on the api
object.
Before
multifactor
property of the context
object. In Actions, this is done with a method on the api
object.
Before
user_metadata
and app_metadata
properties in Rules requires a call to the Management API, which can lead to rate limit errors. Actions, however, provides a way to indicate multiple user metadata changes but only call the Management API once.
Before
api.user.setUserMetadata
or api.user.setAppMetadata
. In Actions, multiple calls to these functions across one or more Actions will result in a single Management API call once the flow is complete.
context.sso
object provides details about the current session and clients using it. For more information, see the context.sso
entry in Context Object Properties in Rules. Similar information is available in the Actions event.session
object.
Before