You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit f38cf02
Browse filesBrowse the repository at this point in the historyBrowse files
Add `clerkClient.users.removePassword(userId, params?)` to remove a user's password through the Backend API. Password removal is allowed even when the user has no alternate sign-in method configured. Existing sessions remain active by default; pass `{ signOutOfOtherSessions: true }` to revoke them.
Copy file name to clipboardExpand all lines: packages/backend/src/api/endpoints/UserApi.ts
+39Lines changed: 39 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -366,6 +366,12 @@ export type VerifyPasswordParams = {
366
366
password: string;
367
367
};
368
368
369
+
/** @inline */
370
+
exporttypeRemovePasswordParams={
371
+
/** When set to `true`, all of the user's active sessions are revoked after their password is removed. Defaults to `false`. */
372
+
signOutOfOtherSessions?: boolean;
373
+
};
374
+
369
375
/** @generateWithEmptyComment */
370
376
exporttypeVerifyTOTPParams={
371
377
/** The ID of the user to verify the TOTP for. */
@@ -697,6 +703,39 @@ export class UserAPI extends AbstractAPI {
697
703
});
698
704
}
699
705
706
+
/**
707
+
* Removes the password credential from the given user. This is a privileged operation and does not require the user's current password. Password removal is allowed even when the user has no other sign-in method configured.
708
+
*
709
+
* By default, existing sessions remain active. Set `signOutOfOtherSessions` to `true` to revoke sessions active when the request is processed.
710
+
* @param userId - The ID of the user whose password to remove.
711
+
* @param params - Options for the request.
712
+
* @returns The updated [`User`](https://clerk.com/docs/reference/backend/types/backend-user).
713
+
* @example
714
+
* ### Keep existing sessions active
715
+
*
716
+
* ```ts
717
+
* const user = await clerkClient.users.removePassword('user_123');
718
+
* ```
719
+
*
720
+
* @example
721
+
* ### Revoke existing sessions
722
+
*
723
+
* ```ts
724
+
* const user = await clerkClient.users.removePassword('user_123', {
0 commit comments