Step 2: Authenticate Your User
    • Dark
      Light
    • PDF

    Step 2: Authenticate Your User

    • Dark
      Light
    • PDF

    Article summary

    There are various Rocket.Chat endpoints that require authentication. See the Introduction to Authentication guide for an in-depth overview of authentication.

    For this example, use the Login with Username and Password endpoint to get the user ID and generate an authentication token.

    On the Login with Username and Password endpoint page, enter the username and password you used in Step 1: Register Yourself as a User.

    For example,

    {
     "username": "rogersmith",
     "password": "passw0rd"
    }

    Click Try it!

    A successful response returns the user details. Be sure to copy the values of the userId and authToken values. The details will be lost on leaving the page, and you have to send the request again. You must use these values as X-User-Id and X-Auth-Token header parameters, respectively when making requests that mandate authentication.

    Next, let’s see how to send requests using these authentication parameters.


    Was this article helpful?

    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.