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.