Skip to main content

setPasswordCompromised()

Sets the given user's password as compromised. The user will be prompted to reset their password on their next sign-in. See the guide on password protection and rules for more information.

Returns the updated User.

function setPasswordCompromised(userId: string, params: { revokeAllSessions?: boolean }): Promise<User>
  • Name
    userId
    Type
    string
    Description

    The ID of the user to set the password as compromised for.

  • Name
    params
    Type
    { revokeAllSessions?: boolean; }
    Description

    Other parameters for the request.

  • Name
    params.revokeAllSessions?
    Type
    boolean
    Description

    Whether to revoke all sessions of the user. Defaults to false.

Note

Using clerkClient varies based on the SDK you're using. Refer to the overview for usage details, including guidance on how to access the userId and other properties.

const userId = 'user_123'

const response = await clerkClient.users.setPasswordCompromised(userId, {
  revokeAllSessions: true,
})

Backend API (BAPI) endpoint

This method in the SDK is a wrapper around the BAPI endpoint POST/users/{user_id}/password/set_compromised. See the BAPI reference for more information.

Feedback

What did you think of this content?

Last updated on