查看 Apigee Edge 說明文件。
前往
Apigee X說明文件。 資訊

結果
刪除指定的 OAuth V2 授權碼或存取權杖。
範例
刪除存取權杖
以下政策範例是用來刪除 OAuth 2.0 存取權杖。以下範例找出
透過尋找名為
access_token
。
<DeleteOAuthV2Info name="DeleteAccessToken"> <AccessToken ref="request.header.access_token"></AccessToken> </DeleteOAuthV2Info>
刪除驗證碼
以下範例政策是用來刪除 OAuth 2.0 授權碼。以下範例
在要求訊息中找出要刪除的驗證碼:
code
。
<DeleteOAuthV2Info name="DeleteAuthCode"> <AuthorizationCode ref="request.queryparam.code"></AuthorizationCode> </DeleteOAuthV2Info>
元素參照
元素參照會說明 DeleteOAuthV2Info 的元素和屬性 政策。
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <DeleteOAuthV2Info async="false" continueOnError="false" enabled="true" name="DeleteOAuthV2Info-1"> <DisplayName>Delete OAuth v2.0 Info 1</DisplayName> <AccessToken ref={some-variable}></AccessToken> <!--<AuthorizationCode ref={some-variable}></AuthorizationCode>--> <Attributes/> </DeleteOAuthV2Info
<DeleteOAuthV2Info>屬性
<DeleteOAuthV2Info async="false" continueOnError="false" enabled="true" name="Delete-OAuth-v20-Info-1">
屬性 | 說明 | 預設 | 存在必要性 |
---|---|---|---|
非同步 |
設為 這項設定僅供內部最佳化使用。 |
false | 選用 |
continueOnError |
多數政策預期會在失敗時傳回錯誤。透過設定
屬性設為 |
false | 選用 |
已啟用 | 決定是否強制執行政策。如果設為 false ,系統會傳送
政策「已停用」且不會強制執行 (即使該政策依附於
Flow)。 |
true | 選用 |
名稱 |
政策的內部名稱。要在 Step 元素中參照這個名稱 再將政策套用至流程 注意:名稱中可用的字元僅限於:
|
不適用 | 必填 |
<AccessToken>元素
識別要刪除的存取權杖所在的變數。舉例來說,
存取權杖會附加至要求訊息,做為名為「access_token」的查詢參數,請指定
request.queryparam.access_token
。您可以使用任何參照
產生下一個符記或者,也可以傳入常值權杖字串 (極少有大小寫之分)。
<AccessToken ref="request.queryparam.access_token"></AccessToken>
預設: | 不適用 |
所在地: | <AccessToken> 或 <AuthorizationCode> 為
這通常代表交易
不會十分要求關聯語意 |
類型: | 字串 |
屬性
屬性 | 說明 | 預設 | 存在必要性 |
---|---|---|---|
參考資料 |
存取權杖變數。通常擷取自流程變數。適用對象
例如 |
不適用 | 選用 |
<AuthorizationCode>元素
識別要刪除的授權代碼所在的變數。舉例來說,
授權碼會附加在要求訊息中,做為「code」查詢參數。請指定
request.queryparam.code
。您可以使用參照該權杖的任何有效變數。
或者,也可以傳入常值權杖字串 (極少有大小寫之分)。
<AuthorizationCode ref="request.queryparam.code"></AuthorizationCode>
預設: | 不適用 |
所在地: | <AccessToken> 或 <AuthorizationCode> 為
這通常代表交易
不會十分要求關聯語意 |
類型: | 字串 |
屬性
屬性 | 說明 | 預設 | 存在必要性 |
---|---|---|---|
參考資料 |
存取權杖變數。通常擷取自流程變數。適用對象
例如 |
不適用 | 選用 |
<DisplayName> 元素
管理 UI Proxy 編輯器中政策的自然語言名稱。省略時 政策名稱屬性
<DisplayName>DeleteOAuthV2Info 1</DisplayName>
預設: | 政策 name 屬性的值。 |
所在地: | 選用 |
類型: | 字串 |
錯誤參考資料
This section describes the fault codes and error messages that are returned and fault variables that are set by Edge when this policy triggers an error. This information is important to know if you are developing fault rules to handle faults. To learn more, see What you need to know about policy errors and Handling faults.
Runtime errors
These errors can occur when the policy executes.
Fault code | HTTP status | Cause |
---|---|---|
steps.oauth.v2.invalid_access_token |
401 | The access token sent to the policy is invalid. |
steps.oauth.v2.invalid_request-authorization_code_invalid |
401 | The authorization code sent to the policy is invalid. |
steps.oauth.v2.InvalidAPICallAsNoApiProductMatchFound |
401 | Please see this Apigee Community post for information about troubleshooting this error. |
Deployment errors
Refer to the message reported in the UI for information about deployment errors.
Fault variables
These variables are set when this policy triggers an error at runtime.
Variables | Where | Example |
---|---|---|
fault.name="fault_name" |
fault_name is the name of the fault, as listed in the Runtime errors table above. The fault name is the last part of the fault code. | fault.name = "invalid_access_token" |
oauthV2.policy_name.failed |
policy_name is the user-specified name of the policy that threw the fault. | oauthV2.DeleteTokenInfo.failed = true |
oauthV2.policy_name.fault.name |
policy_name is the user-specified name of the policy that threw the fault. | oauthV2.DeleteTokenInfo.fault.name = invalid_access_token |
oauthv2.policy_name.fault.cause |
policy_name is the user-specified name of the policy that threw the fault. | oauthV2.DeleteTokenInfo.cause = Invalid Access Token |
Example error response
{ "fault": { "faultstring": "Invalid Access Token", "detail": { "errorcode": "keymanagement.service.invalid_access_token" } } }
Example fault rule
<faultrule name="VariableOfNonMsgType"></faultrule><FaultRule name="DeleteOAuthV2Info_Faults"> <Step> <Name>AM-InvalidTokenResponse</Name> </Step> <Condition>(fault.name = "invalid_access_token")</Condition> </FaultRule>
結構定義
每種政策類型都是由 XML 架構 (.xsd
) 定義。供參考政策結構定義
GitHub 提供許多資源。