Conditionally Redirect Users After a Password Reset in New Universal Login

Overview

This article provides a method to conditionally display a redirect button in New Universal Login after a user completes a password reset.

Applies To

  • Password Reset
  • Actions
  • Universal Login

Solution

To conditionally redirect a user after a password reset in a New Universal Login flow:

Method 1: Dynamically Set the Result URL

This method uses the password-reset-post-challenge trigger to set the redirect URL based on conditional logic if redirection following a password reset is only desired in certain scenarios.

  1. Remove the default login routes at the tenant and application levels.
  2. Use conditional logic within the password-reset-post-challenge trigger to call the setResultUrl() method. For more information, refer to the Post-Challenge API Object documentation.
if (<condition>) {
  api.transaction.setResultUrl('<URL>');
}

NOTE: If redirection after a password reset is not desired, the setResultUrl() method should not be called so that Auth0 falls back to the default login routes. It first checks the application’s default login route, followed by the tenant-level route. If no default login route is found, no redirect button is rendered after the password is changed.

Method 2: Use Custom Query Parameters

This method appends custom query parameters to the password reset ticket URL, which can then be used to power conditional logic.

  1. Append custom query parameters to the password reset ticket URL when generating it on a backend system using the Management API. For more details, see how to Create a password change ticket.

    https://<tenant domain>/u/reset-verify?test=test_value&ticket=<generated ticket value>

  2. Use the appended parameters to create conditional logic in the password-reset-post-challenge trigger by inspecting the event.request.query object. For more information, refer to the Post-Challenge Event Object documentation.