---
schema_version: "1"
id: d680d77874d3769ae3317cec10c4ee581f630948cbd05f8d84bc93113272e37d
title: 为 Dremio 设置 OAuth
collection: tableau
version: current
locale: zh-cn
portal_url: https://docs.salesforce.com/tableau/current/zh-cn/server/config_oauth_dremio.md
canonical_url: https://help.tableau.com/current/server/zh-cn/config_oauth_dremio.htm
source_site: help.tableau.com
content_type: documentation
content_hash: 237c4e8d0d1585dfefefc6fed5171da62ef38c8b9331493407804d1771e1f3f5
description: Set up OAuth authentication for Dremio data sources on Tableau Server.
---
[跳转到主要内容](#main-content)

# 为 Dremio 设置 OAuth

本主题介绍如何针对 OAuth 身份验证设置 Dremio 数据源。为每个 Tableau Server 实例完成这些步骤。

为 Dremio 设置 OAuth 的过程包括以下任务：

1. 向 Dremio 注册 OAuth 客户端。
2. 使用您在步骤 1 中获得的信息来针对 Dremio OAuth 配置 Tableau Server。
3. （可选）配置特定于站点的 OAuth。

## 步骤 1：在 Dremio 中注册 OAuth 客户端

使用 Dremio 文档中的[身份提供程序](https://docs.dremio.com/cloud/api/identity-providers/)主题配置一个 Dremio 支持的 IdP 以获取针对 Dremio Oauth 配置 Tableau Server 所需的 OAuth 客户端 ID 和密文配置参数。

## 步骤 2：针对 Dremio OAuth 配置 Tableau Server

若要针对 Dremio OAuth 配置 Tableau Server，您将在后面的 tsm 命令中使用下面列出的参数。

- **Dremio 客户端 ID：**客户端 ID 是通过步骤 1 中的注册生成的。在 tsm 命令中复制 `[your_client_id]` 的此值。
- **Dremio 客户端密文：**客户端密文是通过步骤 1 中的程序生成的。在 tsm 命令中复制 `[your_client_secret]` 的此值。
- **Tableau Server URL：**这是您的 Tableau Server URL，例如 `https://myco.com`。在 tsm 命令中复制 `[your_server_url]` 的此值。
- **配置 ID：**这是您将在 tsm 命令中使用的 `oauth.config.id` 参数的值：`dremio`

运行以下 tsm 命令为 Dremio 配置 OAuth：

`tsm configuration set -k oauth.config.clients -v "[{\"oauth.config.id\":\"dremio\", \"oauth.config.client_id\":\"[your_client_id]\", \"oauth.config.client_secret\":\"[your_client_secret]\", \"oauth.config.redirect_uri\":\"[your_server_url]/auth/add_oauth_token\"}]" --force-keys`

`tsm pending-changes apply`

### 设置多个连接器

如果您要设置多个连接器，则必须在单个命令中包括所有这些连接器。例如： 

`tsm configuration set -k oauth.config.clients -v "[{\"oauth.config.id\":\"dremio\", \"oauth.config.client_id\":\"[your_client_id]\", \"oauth.config.client_secret\":\"[your_client_secret]\", \"oauth.config.redirect_uri\":\"[your_server_url]/auth/add_oauth_token\"}, {\"oauth.config.id\":\"customer_360_audience\", \"oauth.config.client_id\":\"[your_client_id]\", \"oauth.config.client_secret\":\"[your_client_secret]\", \"oauth.config.redirect_uri\":\"[your_server_url]/auth/add_oauth_token\"}, {\"oauth.config.id\":\"azure_sql_dw\", \"oauth.config.client_id\":\"[your_client_id]\", \"oauth.config.client_secret\":\"[your_client_secret]\", \"oauth.config.redirect_uri\":\"[your_server_url]/auth/add_oauth_token\"}, {\"oauth.config.id\":\"azure_sqldb\", \"oauth.config.client_id\":\"[your_client_id]\", \"oauth.config.client_secret\":\"[your_client_secret]\", \"oauth.config.redirect_uri\":\"[your_server_url]/auth/add_oauth_token\"}]" --force-keys`

`tsm pending-changes apply`

## 为站点配置自定义 OAuth

您可以为站点配置自定义 Dremio OAuth。

考虑将自定义 OAuth 客户端配置为 1) 覆盖 OAuth 客户端（如果为服务器配置）或 2) 支持安全连接到需要唯一 OAuth 客户端的数据。

配置自定义 OAuth 客户端时，站点级别配置优先于任何服务器端配置，并且默认情况下创建的所有新 OAuth 凭据都使用站点级别 OAuth 客户端。无需重新启动 Tableau Server 即可使配置生效。

**重要信息：**在配置自定义 OAuth 客户端之前建立的现有 OAuth 凭据暂时可用，但服务器管理员和用户都必须更新他们保存的凭据以帮助确保不间断的数据访问。

### 1：准备 OAuth 客户端 ID、客户端密文值和重定向 URL

在配置自定义 OAuth 客户端之前，您需要下列信息。准备好这些信息后，您可以为站点注册自定义 OAuth 客户端。

- **OAuth 客户端 ID 和客户端密文值：**首先向数据提供程序（连接器）注册 OAuth 客户端，以检索为 Tableau Server value生成的客户端 ID 和密码。
- **重定向 URL：**注意正确的重定向 URL。在下面**步骤 2** 的注册过程中，您将需要此 URL。
    
    Https://<您的服务器名称>.com/auth/add\_oauth\_token
    
    例如，https://example.com/auth/add\_oauth\_token

### 2：注册 OAuth 客户端 ID 和客户端密文

按照下面描述的过程将自定义 OAuth 客户端注册到站点。

1. 使用管理员凭据登录到 Tableau Server 站点，并导航到“设置”页面。
2. 在“OAuth 客户端注册”下，单击“添加 OAuth 客户端”按钮。
3. 输入所需信息，包括上述**步骤 1** 中的信息：
    
    1. 对于“连接类型”，选择要配置其自定义 OAuth 客户端的连接器。
    2. 如果注册多个 OAuth 客户端，则“OAuth 实例 URL”为必填。否则，它是可选的。
    3. 对于“客户端 ID”、“客户端密文”和“重定向 URL”，输入您在上面的**步骤 1** 中准备的信息。
    4. 单击“添加 OAuth 客户端”按钮以完成注册过程。
    
    ![用于创建 OAuth 客户端的表单，包括连接类型、OAuth 实例 URL、客户端 ID、客户端密文和重定向 URL 字段。](/tableau/current/zh-cn/server/zh-cn/Img/oauth_custom.png)
4. （可选）对所有支持的连接器重复步骤 3。
5. 单击“设置”页面底部或顶部的“保存”按钮以保存更改。

### 3：验证和更新保存的凭据

为帮助确保不间断的数据访问，您（和您的站点用户）必须删除之前保存的凭据并再次添加，以便为站点使用自定义 OAuth 客户端。

1. 导航到“我的帐户设置”页面。
2. 在“保存的数据源凭据”下，执行以下操作：
    
    1. 单击您在上述**步骤 2** 中配置的自定义 OAuth 客户端的连接器的现有已保存凭据旁边的“删除”。
    2. 在连接器名称旁边，单击“添加”并按照提示进行操作以 1) 连接到在上述**步骤 2** 中配置的自定义 OAuth 客户端，以及 2) 保存最新的凭据。

### 4：通知用户更新他们保存的凭据

确保通知您的站点用户更新他们为连接器保存的凭据，该连接器的自定义 OAuth 客户端是您在上面的**步骤 2** 中配置的。站点用户可以使用[更新保存的凭据](https://help.tableau.com/current/server/zh-cn/manage_stored_credentials.htm#oauth_update_credentials)中描述的过程来更新他们保存的凭据。

## 用于 OAuth 身份验证的转发代理

有关为 Tableau Server（仅限 Windows）设置具有 OAuth 身份验证的转向代理的详细信息，请参见 Tableau 帮助中的[为 OAuth 身份验证配置转发代理](https://help.tableau.com/current/pro/desktop/zh-cn/config_proxy_oauth.htm#server)。