Conditionally Redirect Users After a Password Reset in New Universal Login
This article provides a method to conditionally display a redirect button in New Universal Login after a user completes a password reset.
- Password Reset
- Actions
- Universal Login
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.
- Remove the default login routes at the tenant and application levels.
- Use conditional logic within the
password-reset-post-challengetrigger to call thesetResultUrl()method. For more information, refer to the Post-Challenge API Object documentation.NOTE: If redirection after a password reset is not desired, theif (<condition>) { api.transaction.setResultUrl('<URL>'); }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.
- 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> - Use the appended parameters to create conditional logic in the
password-reset-post-challengetrigger by inspecting theevent.request.queryobject. For more information, refer to the Post-Challenge Event Object documentation.