Auth0 Home Blog Docs

Change password ticket result url does not include custom error message

change-password

#1

I’m having trouble getting the custom error message the Change Password database action script returns on error to be appended to the result url when I create change password tickets.

The default Change Password script template comments says the following:

  // There are three ways that this script can finish:
  // 1. The user's password was updated successfully:
  //     callback(null, true);
  // 2. The user's password was not updated:
  //     callback(null, false);
  // 3. Something went wrong while trying to reach your database:
  //     callback(new Error("my error message"));

    // If an error is returned, it will be passed to the query string of the page
  // where the user is being redirected to after clicking the confirmation link.
  // For example, returning `callback(new Error("error"))` and redirecting to
  // https://example.com would redirect to the following URL:
  //     https://example.com?email=alice%40example.com&message=error&success=false

I’m trying this as a test:

function changePassword (email, newPassword, callback) {
    callback(new Error('error message'));
}

But the redirect url always looks like this:

http://localhost:3000/?email=foo%40bar.com&success=false&message=The%20operation%20cannot%20be%20completed.%20Please%20try%20again.

Am I misinterpreting this expected behaviour here or is something not working as expected?


#2