增強的錯誤碼
- 主題:
- 驗證
增強的「錯誤碼」代表Adobe Pass驗證功能,可向整合以下專案的使用者端應用程式提供其他錯誤資訊:
-
Adobe Pass驗證REST API:
-
Adobe Pass驗證SDK預先授權API:
(*) Preauthorize API是唯一支援增強型錯誤碼的Adobe Pass驗證SDK API。
表示
根據整合的Adobe Pass驗證API和使用的「接受」標頭值(亦即application/json
或application/xml
),增強型錯誤代碼可以以JSON
或XML
格式表示:
- 最上層錯誤資訊:在此情況下,"error" 物件位於最上層,因此回應本文只能包含***"error"***物件。
- 專案層級錯誤資訊:在此情況下,"error" 物件位於專案層級,因此回應內文可能會針對在服務時發生錯誤的所有專案包含***"error"***物件。
REST API v2
請參閱下列HTTP回應,其中包含適用於REST API v2且以JSON
表示的增強型錯誤代碼範例。
HTTP/1.1 200 OK
Content-Type: application/json
{
"decisions": [
{
"resource": "REF30",
"serviceProvider": "REF30",
"mvpd": "Cablevision",
"source": "mvpd",
"authorized": true,
"token": {
"issuedAt": 1697094207324,
"notBefore": 1697094207324,
"notAfter": 1697094802367,
"serializedToken": "PHNpZ25hdHVyZUluZm8..."
}
},
{
"resource": "REF40",
"serviceProvider": "REF40",
"mvpd": "Cablevision",
"source": "mvpd",
"authorized": false,
"error" : {
"action": "none",
"status": 403,
"code": "authorization_denied_by_mvpd",
"message": "The MVPD has returned a \"Deny\" decision when requesting authorization for the specified resource",
"details": "Your subscription package does not include the \"Live\" channel",
"helpUrl": "https://experienceleague.adobe.com/docs/pass/authentication/auth-features/error-reportn/enhanced-error-codes.html?lang=zh-Hant",
"trace": "12f6fef9-d2e0-422b-a9d7-60d799abe353"
}
}
]
}
HTTP/1.1 400 Bad Request
Content-Type: application/json
{
"action": "none",
"status": 400,
"code": "invalid_parameter_service_provider",
"message": "The service provider parameter value is missing or invalid.",
"helpUrl": "https://experienceleague.adobe.com/docs/pass/authentication/auth-features/error-reportn/enhanced-error-codes.html?lang=zh-Hant",
"trace": "12f6fef9-d2e0-422b-a9d7-60d799abe353"
}
REST API v1
請參閱下列HTTP回應,其中包含適用於REST API v1且以JSON
或XML
表示的增強型錯誤代碼範例。
HTTP/1.1 200 OK
Content-Type: application/json
{
"resources": [
{
"id": "TestStream1",
"authorized": true
},
{
"id": "TestStream2",
"authorized": false,
"error": {
"action": "none",
"status": 403,
"code": "authorization_denied_by_mvpd",
"message": "The MVPD has returned a \"Deny\" decision when requesting authorization for the specified resource",
"details": "Your subscription package does not include the \"Live\" channel",
"helpUrl": "https://experienceleague.adobe.com/docs/pass/authentication/auth-features/error-reportn/enhanced-error-codes.html?lang=zh-Hant",
"trace": "12f6fef9-d2e0-422b-a9d7-60d799abe353"
}
}
]
}
HTTP/1.1 400 Bad Request
Content-Type: application/json
{
"action": "none",
"status": 400,
"code": "invalid_requestor",
"message": "The requestor parameter is missing or invalid.",
"helpUrl": "https://experienceleague.adobe.com/docs/pass/authentication/auth-features/error-reportn/enhanced-error-codes.html?lang=zh-Hant",
"trace": "8bcb17f9-b172-47d2-86d9-3eb146eba85e"
}
HTTP/1.1 400 Bad Request
Content-Type: application/xml
<error>
<action>none</action>
<status>400</status>
<code>invalid_requestor</code>
<message>The requestor parameter is missing or invalid.</message>
<helpUrl>https://experienceleague.adobe.com/docs/pass/authentication/auth-features/error-reportn/enhanced-error-codes.html?lang=zh-Hant</helpUrl>
<trace>8bcb17f9-b172-47d2-86d9-3eb146eba85e</trace>
</error>
結構
增強型錯誤碼包含下列JSON
欄位或具有範例的XML
屬性:
若服務合作夥伴未提供任何自訂訊息,此欄位可能不存在。
此欄位包含絕對URL,不應從錯誤碼推斷,視錯誤內容而定,可以提供不同的URL。
動作
增強的「錯誤碼」包含「action」欄位,此欄位提供可修正此情況的建議動作。
「動作」欄位可能的值包括:
(*)對於某些錯誤,多個動作可能是可能的解決方案,但「action」欄位表示修正錯誤的可能性最高的動作。
狀態
增強型錯誤碼包含一個「狀態」欄位,可指示與錯誤相關聯的HTTP狀態代碼。
「狀態」欄位可能的值包括:
當使用者端產生錯誤,而且大部分時間表示使用者端需要額外的工作來修復錯誤時,通常會出現具有4xx「狀態」的增強型錯誤代碼。
當伺服器產生錯誤且大部分時間表示伺服器需要額外的工作來修復錯誤時,通常會出現具有5xx「狀態」的增強錯誤碼。
程式碼
增強的「錯誤代碼」包含「代碼」欄位,此欄位提供與錯誤相關的Adobe Pass驗證唯一識別碼。
根據整合的Adobe Pass驗證API,「代碼」欄位可能的值在兩個清單中彙總在以下。
清單
REST API v2
下表列出使用者端應用程式在與Adobe Pass Authentication REST API v2整合時可能遇到的增強型錯誤代碼。
REST API v1
下表列出使用者端應用程式在與Adobe Pass驗證REST API v1整合時可能遇到的增強型錯誤代碼。
簡而言之,處理包含增強型錯誤碼的回應時,您應考量下列事項:
-
檢查兩個狀態值:一律檢查HTTP回應狀態碼和增強錯誤碼「狀態」欄位。 兩者可能有所不同,而且都提供有價值的資訊。
-
無法辨識最上層與專案層級的錯誤資訊:處理最上層與專案層級的錯誤資訊,無法辨識其傳達方式,請確定您可以處理兩種傳輸增強型錯誤碼的形式。
-
重試邏輯:對於需要重試的錯誤,請確定重試是以指數回溯完成,以避免讓伺服器不知所措。 此外,如果是Adobe Pass驗證API同時處理多個專案(例如,預先授權API),您應在重複請求中僅包含標籤為「重試」的專案,而非整個清單。
-
組態變更:對於需要組態變更的錯誤,請確保在啟動新應用程式或新功能之前進行必要的變更。
-
驗證和授權:對於與驗證和授權相關的錯誤,您必須視需要提示使用者重新驗證或取得新的授權。
-
使用者意見反應:選擇性,使用人類可讀的「訊息」和(可能的)「詳細資料」欄位,通知使用者此問題。 「詳細資料」文字訊息可能會從MVPD預先授權或授權端點傳遞,或從程式設計師在套用降級規則時傳遞。