Changes to login tokens lead to server-side reactivity?

Maybe this is just a naive question regarding the accounts-* packages for Meteor v2.14 and v3, but I found that if login tokens are cleaned in a server method (e.g., via Accounts.setPasswordAsync()), then the same server method involving the reference to a reactive source of user data (e.g., Meteor.userAsync()) would re-run itself, which causes problems because the user has been logged out and reactive source returns null. Is this natural by its design, and what would be the solution? Thanks.

Set options.logout to false

/**
 * @summary Forcibly change the password for a user.
 * @locus Server
 * @param {String} userId The id of the user to update.
 * @param {String} newPassword A new password for the user.
 * @param {Object} [options]
 * @param {Object} options.logout Logout all current connections with this userId (default: true)
 * @importFromPackage accounts-base
 */
1 Like

That’s the issue since I need to logout users on the server side in many other server methods for security reason. Still, thanks for the response!