---
schema_version: "1"
id: 7046b0edd9e520b80bbe101c6c46854452453fb0a5591b39526f8b62b73b8789
title: 配置 SAP HANA 的外部 OAuth
collection: tableau
version: current
locale: zh-cn
portal_url: https://docs.salesforce.com/tableau/current/zh-cn/server/config_oauth_hana.md
canonical_url: https://help.tableau.com/current/server/zh-cn/config_oauth_hana.htm
source_site: help.tableau.com
content_type: documentation
content_hash: 1db0af3ee99da99bee9c96728aff161ded70a642b0c2954d3101cbed5236b8b6
description: Configure external OAuth 2.0/OIDC identity federation for SAP HANA in Tableau Cloud.
---
[跳转到主要内容](#main-content)

# 配置 SAP HANA 的外部 OAuth

从 Tableau Cloud 的 Tableau 2024.3 开始，您可以使用 OAuth 2.0/OIDC 将外部身份提供程序的身份联合到 HANA。

根据身份提供程序的不同，配置集成需要执行不同的步骤。这是一个简略概述。

## 在 HANA 上配置 IDP

有关在 HANA 上配置 IdP 的信息，请参见 SAP 帮助系统中的[使用 JSON Web 令牌进行单点登录](https://help.sap.com/docs/hana-cloud-database/sap-hana-cloud-sap-hana-database-security-guide/single-sign-on-using-json-web-tokens)。

以下是设置 IdP 的不同方法的一些示例：

- 使用 HANA Cockpit 的 Okta IdP：[使用 Okta 帐户连接到 SAP HANA Cloud](https://help.alteryx.com/current/en/designer/data-sources/sap-hana/connect-to-sap-hana-cloud-with-okta-account.html#connect-to-sap-hana-cloud-with-okta-account)
- 使用 HANA Studio 的 Azure IdP：[使用 OAuth 或 SSO 设置 SAP HANA 实例](https://www2.microstrategy.com/producthelp/Current/Gateway_Connections/WebHelp/Lang_1033/Content/sap_hana_instance_oauth_sso.htm)

## 配置 IDP

1. 在 IDP 上为 Tableau Desktop 和 Tableau Server 或 Tableau Cloud 创建 OAuth 客户端。Desktop 客户端应启用 [`PKCE`](https://auth0.com/docs/get-started/authentication-and-authorization-flow/authorization-code-flow-with-pkce) 并使用 `http://localhost` 重定向。
2. 创建 Tableau OAuth 配置文件。有关如何执行此操作的详细信息，请参见 [GitHub](https://tableau.github.io/connector-plugin-sdk/docs/oauth "GitHub 上的 OAuth 文档") 上的 [OAuth 配置和使用](https://tableau.github.io/connector-plugin-sdk/docs/oauth)，以及[此处](https://github.com/tableau/connector-plugin-sdk/tree/master/samples/components/oauth "GitHub 上的 OAuth 示例。")的示例。我们欢迎提供其他 IDP 的示例。
    
    1. 请务必在 Tableau OAuth 配置 ID 前添加“`custom_`”前缀。
        
        **注意：**OAuth 配置 ID 的最大限制为 36 个字符。长于此长度的 ID 可能不会生成错误，但将不起作用。
    2. 如果您的 IDP 支持动态本地主机端口，则禁用 `OAUTH_CAP_FIXED_PORT_IN_CALLBACK_URL`。如果您的 IDP 不支持此功能，请确保将多个本地主机回调 URL 添加到配置文件和 IDP 上的允许列表中。
3. 在与桌面主机（Tableau Desktop、Tableau Prep Builder、Tableau Bridge）上的每个应用程序关联的 `OAuthConfigs` 文件夹中，以及在将通过站点设置页面使用 OAuth 的每个 Tableau Server 和 Tableau Cloud 站点上，安装新的 Tableau OAuth 配置文件。有关更多详细信息，请参见 [Desktop 上的自定义 OAuth 配置](https://tableau.github.io/connector-plugin-sdk/docs/oauth#site-level-oauth-clients)和[站点级别 OAuth 客户端](https://tableau.github.io/connector-plugin-sdk/docs/oauth#custom-oauth-configs-on-desktop)。

## 连接到 HANA

用户必须选择“使用 OAuth 登录”，然后选择之前安装的“OAuth 提供程序”。

![](/tableau/current/zh-cn/server/zh-cn/Img/hana_connect.png)

## Okta

如果使用 Okta，最好使用“自定义授权服务器”而不是“组织授权服务器”。自定义授权服务器更加灵活。默认创建一个自定义授权服务器，称为“默认”。授权 URL 应如下所示：

https://${yourOktaDomain}/oauth2/{authServerName}/v1/authorize

![](/tableau/current/zh-cn/server/zh-cn/Img/redshift_oauth_iam_okta_800x332.png)