tencent cloud

Feedback

Reset User Password

Last updated: 2023-12-22 11:42:07

    API Description

    This API is used to reset the user password. Before calling this API, you need to call the API for sending one-time password (OTP) verification code to send a verification code to user.
    Note:
    The new password must comply with the policies of the account and password authentication source associated with the application. It cannot be the same as the previous N passwords specified in the policy.

    Supported Applications

    Web applications, single-page applications (SPA), and mobile applications.

    Request Method

    POST

    Request Path

    /reset_user_password

    Request Content-Type

    application/json

    Sample Requests

    POST /reset_user_password HTTP/1.1
    Content-Type: application/json
    Authorization: Basic VEVOQU5UX0NMSUVOVF9JRDpURU5BTlRfQ0xJRU5UX1NFQ1JFVA==
    Host: sample.portal.tencentciam.com
    
    {
    "password" : "MOCK_PASSWORD",
    "email" : "MOCK_EMAIL@163.com",
    "email_otp" : "MOCK_EMAIL_OTP",
    "email_otp_token" : "MOCK_EMAIL_OTP_TOKEN"
    }

    Request Headers

    Name
    Description
    Authorization
    HTTP Basic authentication request header. The format is Basic <credentials>, where `Basic` is a fixed string and <credentials> is calculated by base64(url_encode(client_id) + ":" + url_encode(client_secret)). `Basic` and <credentials> are separated by a space.
    

    Request Parameters in JSON Format

    JSON Path
    Data Type
    Description
    client_id
    String
    The client_id of the application. This should be the same as that used for sending verification code.
    client_secret
    String
    The client_secret of the application. This parameter is required for web applications, yet it is not needed for SPA and mobile applications.
    password
    String
    New password.
    email
    String
    The user's email address. This parameter is required for sending email OTP verification code.
    email_otp_token
    String
    The otp_token returned by the server after the email verification code is sent.
    email_otp
    String
    The OTP verification code received by the user's email.
    phone_number
    String
    The user's mobile number. This parameter is required for sending SMS OTP verification code.
    phone_number_otp_token
    String
    The otp_token returned by the server after the SMS verification code is sent.
    phone_number_otp
    String
    The OTP verification code received by the user's mobile phone.
    

    Sample Success Responses

    The password is reset.
    HTTP/1.1 200 OK

    Sample Error Responses

    The new password is the same as a previous password.
    HTTP/1.1 400 Bad Request
    Content-Type: application/json;charset=UTF-8
    
    {
    "error" : "recurrent_password"
    }
    The new password does not comply with the password policy.
    HTTP/1.1 400 Bad Request
    Content-Type: application/json;charset=UTF-8
    
    {
    "error" : "invalid_new_password"
    }
    No user found for the email address.
    HTTP/1.1 400 Bad Request
    Content-Type: application/json;charset=UTF-8
    
    {
    "error" : "user_not_found"
    }
    The password cannot be reset because the user account is frozen.
    HTTP/1.1 400 Bad Request
    Content-Type: application/json;charset=UTF-8
    
    {
    "error" : "abnormal_user_status",
    "error_description" : "User is frozen."
    }
    The email_otp_token parameter is incorrect or has expired, or Reset parameter value used for resetting is not the same as the one used for sending the verification code. For example, the email addresses are different.
    HTTP/1.1 400 Bad Request
    Content-Type: application/json;charset=UTF-8
    
    {
    "error" : "bad_email_otp_token"
    }
    The email_otp parameter is incorrect or has expired.
    HTTP/1.1 400 Bad Request
    Content-Type: application/json;charset=UTF-8
    
    {
    "error" : "bad_email_otp"
    }
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support