---
schema_version: "1"
id: d8776b69d099e0577460ed6ba70d9705c5237b7cd664fee4c3d4c406c324392e
title: 從 Tableau Server 獲取票證
collection: tableau
version: current
locale: zh-tw
portal_url: https://docs.salesforce.com/tableau/current/zh-tw/server/trusted_auth_webrequ.md
canonical_url: https://help.tableau.com/current/server/zh-tw/trusted_auth_webrequ.htm
source_site: help.tableau.com
content_type: documentation
content_hash: 9f74a3c7a69329d2bf1ca9320427830ffb134f80ace2854187baf9a946c5485d
description: Configure your web server to get tickets from Tableau Server via POST.
---
[跳至主要內容](#main-content)

# 從 Tableau Server 獲取票證

在向 Tableau Server [新增受信任的 IP 位址](https://help.tableau.com/current/server/zh-tw/trusted_auth_trustIP.htm)之後，您就可以將 Web 伺服器設定為透過 POST 請求從 Tableau Server 獲取票證（[圖中的步驟 2](https://help.tableau.com/current/server/zh-tw/trusted_auth.htm)）。POST 請求必須傳送至 `http://<server_name>/trusted`。例如，POST 請求必須傳送至 `http://tabserv/trusted`，而不是 `http://tabserv`。

**附註：**如果啟用 SSL，則必須使用 https 而不是 http。例如： `https://tabserv/trusted`。

下面是可在向 Tableau Server 傳送的 POST 請求中使用的資料：

- **`username=<username>`** （必需）：取得授權的 Tableau Server 使用者的使用者名稱。如果使用的是本機驗證，則使用者名可以是簡單字串（例如，`username=jsmith`）。如果將 Active Directory 用於多個域，則使用者名中必須包含網域名稱（例如，`username=MyCo\jsmith`）。
- **`target_site=<site id>`** （如果檢視不在預設網站上，則為必需）：如果 Tableau Server 執行[多個網站](https://help.tableau.com/current/server/zh-tw/sites.htm)，並且檢視位於預設網站之外的其他網站上（例如，`target_site=Sales`），則指定包含該檢視的網站。用於 `<site id>` 的值應為建立該網站時提供的[網站 ID](https://help.tableau.com/current/server/zh-tw/sites_add.htm)。此值區分大小寫。如果網站 ID 為 `SAles`，則 `target_site=SAles`。
- **`client_ip=<IP address>`** （可選）：用於指定 Web 瀏覽器要存取該檢視的電腦的 IP 位址（例如，`client_ip=123.45.67.891`）。該位址不是發出 Tableau Server 的 POST 請求的 Web 伺服器 IP 位址。如果您決定使用此參數，請參閱[可選：設定用戶端 IP 相符](https://help.tableau.com/current/server/zh-tw/trusted_auth_optional.htm)以瞭解更多資訊。

Tableau Server 對 POST 請求的回應將是一個唯一字串（即票證）。如果 Tableau Server 無法處理該請求，則返回 `-1`。有關如何更正此問題的提示，請參閱[從 Tableau Server 返回了票證值 -1](https://help.tableau.com/current/server/zh-tw/trusted_auth_trouble_1return.htm)。同樣，為了讓使用者在按一下嵌入檢視時成功進行驗證，其伺服器必須設定為[允許協力廠商 Cookie](https://help.tableau.com/current/server/zh-tw/trusted_auth_trouble_cookie.htm)。

Tableau Server 10.2 中的票證格式已變更。票證格式現在是由兩個部分組成的字串。每個部分都是一個 128 位元字串，該字串在返回到用戶端之前將進行編碼。第一部分是一個 Base64 編碼的全域唯一 ID (UUID v4)。第二部分是一個 24 字元安全隨機字串。這兩個部分的串連可以表示為 Base64(UUIDv4):SecureRandomString。票證的範例可能如下所示：`9D1ObyqDQmSIOyQpKdy4Sw==:dg62gCsSE0QRArXNTOp6mlJ5`。

接下來，您需要新增一段代碼以允許 Web 伺服器為該檢視[構造 URL](https://help.tableau.com/current/server/zh-tw/trusted_auth_webURL.htm)，此 URL 應包含該檢視的位置以及票證。