Skip to content
This repository has been archived by the owner on Jun 27, 2024. It is now read-only.

Commit

Permalink
GITBOOK-1268: update auth tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
Funke Olasupo authored and gitbook-bot committed Mar 18, 2024
1 parent f150201 commit ada5f14
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
# Authentication

To access the Rocket.Chat API, you need to log in using your `username` and `password`. This authentication method allows you to interact securely with the Rocket.Chat server and perform actions on behalf of the authenticated user.
Rocket.Chat provides diverse authentication methods for secure API communication, spanning from basic [username and password authentication](login.md) to OAuth integration with services such as [Google](google.md), [Facebook](facebook.md), and [Twitter](twitter.md).

Upon successful authentication, the API will provide an authentication token (`authToken`) and a unique user identifier (`userId`) as part of the JSON response. These values should be used as headers in subsequent requests to protected endpoints that require authentication.
To access protected endpoints in the Rocket.Chat API, you must include the userId and a valid authentication token of the user as headers in the request. Add the authentication token as `x-Auth-Token` and the userId as `x-User-Id` in the headers of your request.

{% hint style="info" %}
The `authToken`is passed as `X-Auth-Token` header, while the `userId` as `X-User-Id` header.
{% endhint %}
#### Authentication Tokens

The Rocket.Chat API also supports other forms of authentication using OAuth apps like [Facebook](facebook.md), [Google](google.md), and [Twitter](twitter.md). Go to the subsequent endpoint topics to know more.
Authentication tokens are unique identifiers confirming a user's active session within your Rocket.Chat workspace. These tokens validate the user's identity and permissions, providing secure access to various features and resources. When making requests to protected endpoints that mandate authentication, add this authentication token as `x-Auth-Token` header in your request.

In Rocket.Chat, there are primarily two types of authentication tokens: **authToken** and **personal access token**.

1. **authToken**

`authToken` is a temporary authentication token returned to users after a successful login through any login endpoint. Additionally, workspace administrators can create `authtoken` for a user via the [Create User Token](../user-management/users-endpoints/create-users-token.md) endpoint.
2. **personal access token**

[Personal Access Tokens](https://docs.rocket.chat/use-rocket.chat/user-guides/user-panel/account#personal-access-tokens) are permanent authentication tokens that users can generate for themselves to access the API securely without exposing their primary credentials. Visit the [Generate Personal Access Tokens API guide](../user-management/users-endpoints/generatepersonalaccesstoken.md) for more details.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Create Users Token

Create a user authentication token. This is the same type of session authentication token a user gets via [login.md](../../../../realtime-api/method-calls/authentication/login.md "mention") and expires the same way.
As a workspace admin, you can create temporary authentication tokens for users. This is the same type of session authentication token a user gets via [login.md](../../../../realtime-api/method-calls/authentication/login.md "mention") and expires the same way.

{% hint style="info" %}
* To use this endpoint, you must add the [environment variable](https://docs.rocket.chat/deploy/rocket.chat-environment-configuration/environment-variables) `CREATE_TOKENS_FOR_USERS=true`in your compose file.
Expand Down

0 comments on commit ada5f14

Please sign in to comment.