[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-09-05。"],[[["\u003cp\u003eThis page details how to use the DeleteOAuthV2Info policy in Apigee and Apigee hybrid to delete OAuth V2 access tokens or authorization codes.\u003c/p\u003e\n"],["\u003cp\u003eThe policy can delete either an access token or an authorization code, and requires specifying the location of the token or code within the request message using the \u003ccode\u003e<AccessToken ref="...">\u003c/code\u003e or \u003ccode\u003e<AuthorizationCode ref="...">\u003c/code\u003e elements, respectively.\u003c/p\u003e\n"],["\u003cp\u003eThe DeleteOAuthV2Info policy uses an XML structure with configurable attributes like \u003ccode\u003easync\u003c/code\u003e, \u003ccode\u003econtinueOnError\u003c/code\u003e, \u003ccode\u003eenabled\u003c/code\u003e, and \u003ccode\u003ename\u003c/code\u003e, all of which are optional, except for \u003ccode\u003ename\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe policy can trigger runtime errors, such as \u003ccode\u003einvalid_access_token\u003c/code\u003e or \u003ccode\u003einvalid_request-authorization_code_invalid\u003c/code\u003e, and sets fault variables that can be used to handle these errors with fault rules.\u003c/p\u003e\n"],["\u003cp\u003eThis policy is categorized as an Extensible policy, which may have cost or utilization implications based on your specific Apigee license.\u003c/p\u003e\n"]]],[],null,["# DeleteOAuthV2Info policy\n\n*This page\napplies to **Apigee** and **Apigee hybrid**.*\n\n\n*View [Apigee Edge](https://docs.apigee.com/api-platform/get-started/what-apigee-edge) documentation.*\n\n### What\n\nDeletes the specified OAuth V2 authorization code or access token.\n| **Note:** Alternatively, you can revoke and re-approve tokens, as described in [Approving and\n| revoking access tokens](/apigee/docs/api-platform/security/oauth/validating-and-invalidating-access-tokens).\n\nThis policy is an *Extensible policy* and use of this policy might have cost or\nutilization implications, depending on your Apigee license. For information on policy types\nand usage implications, see\n[Policy types](/apigee/docs/api-platform/reference/policies/reference-overview-policy#policy-types).\n\nSamples\n-------\n\n### Delete Access Token\n\nBelow is an example policy used to delete an OAuth 2.0 access token. The example below locates\nthe access token to delete on the request message by looking for a header called\n`access_token`. \n\n```scdoc\n\u003cDeleteOAuthV2Info name=\"DeleteAccessToken\"\u003e\n \u003cAccessToken ref=\"request.header.access_token\"\u003e\u003c/AccessToken\u003e\n\u003c/DeleteOAuthV2Info\u003e\n```\n\n### Delete Auth Code\n\nBelow is an example policy used to delete an OAuth 2.0 authorization code. The example below\nlocates the auth code to delete on the request message by looking for a query parameter called\n`code`. \n\n```text\n\u003cDeleteOAuthV2Info name=\"DeleteAuthCode\"\u003e\n \u003cAuthorizationCode ref=\"request.queryparam.code\"\u003e\u003c/AuthorizationCode\u003e\n\u003c/DeleteOAuthV2Info\u003e\n```\n\n*** ** * ** ***\n\nElement Reference\n-----------------\n\nThe element reference describes the elements and attributes of the DeleteOAuthV2Info\npolicy. \n\n```gdscript\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?\u003e\n\u003cDeleteOAuthV2Info async=\"false\" continueOnError=\"false\" enabled=\"true\" name=\"DeleteOAuthV2Info-1\"\u003e \n \u003cDisplayName\u003eDelete OAuth v2.0 Info 1\u003c/DisplayName\u003e\n \u003cAccessToken ref={some-variable}\u003e\u003c/AccessToken\u003e\n \u003c!--\u003cAuthorizationCode ref={some-variable}\u003e\u003c/AuthorizationCode\u003e--\u003e\n \u003cAttributes/\u003e\n\u003c/DeleteOAuthV2Info\n```\n\n\\\u003cDeleteOAuthV2Info\\\u003e attributes\n--------------------------------\n\n```text\n\u003cDeleteOAuthV2Info async=\"false\" continueOnError=\"false\" enabled=\"true\" name=\"Delete-OAuth-v20-Info-1\"\u003e\n```\n\n\\\u003cAccessToken\\\u003e element\n-----------------------\n\nIdentifies the variable where the access token to delete is located. For example, if the\naccess token is attached to request message as a query parameter called \"access_token\", specify\n`request.queryparam.access_token`. You can use any valid variable that references the\ntoken. Or, could pass in the literal token string (rare case). \n\n```scdoc\n \u003cAccessToken ref=\"request.queryparam.access_token\"\u003e\u003c/AccessToken\u003e\n```\n\n### Attributes\n\n\\\u003cAuthorizationCode\\\u003e element\n-----------------------------\n\nIdentifies the variable where the authorization code to delete is located. For example, if the\nauth code is attached to request message as a query parameter called \"code\", specify\n`request.queryparam.code`. You can use any valid variable that references the token.\nOr, could pass in the literal token string (rare case). \n\n```text\n \u003cAuthorizationCode ref=\"request.queryparam.code\"\u003e\u003c/AuthorizationCode\u003e\n```\n\n### Attributes\n\n\\\u003cDisplayName\\\u003e\nelement\n-----------------------\n\nA natural-language name that labels the policy in the Apigee UI proxy editor. If omitted,\nthe policy name attribute is used. \n\n```text\n\u003cDisplayName\u003eDeleteOAuthV2Info 1\u003c/DisplayName\u003e\n```\n\nError reference\n---------------\n\n\nThis section describes the fault codes and error messages that are returned and fault variables that are set by Apigee when this policy triggers an error.\nThis information is important to know if you are developing fault rules to\nhandle faults. To learn more, see [What you need to know\nabout policy errors](/apigee/docs/api-platform/fundamentals/what-you-need-know-about-policy-errors) and [Handling\nfaults](/apigee/docs/api-platform/fundamentals/fault-handling).\n\n### Runtime errors\n\nThese errors can occur when the policy executes.\n\n### Deployment errors\n\nRefer to the message reported in the UI for information about deployment errors.\n\n### Fault variables\n\nThese variables are set when this policy triggers an error at runtime.\n| **Note:** You an use these variables to create Fault Rule conditions. For more information, see [What you need to know\n| about policy errors](/apigee/docs/api-platform/fundamentals/what-you-need-know-about-policy-errors).\n\n### Example error response\n\n```scdoc\n{\n \"fault\": {\n \"faultstring\": \"Invalid Access Token\",\n \"detail\": {\n \"errorcode\": \"keymanagement.service.invalid_access_token\"\n }\n }\n}\n```\n\n### Example fault rule\n\n```scdoc\n\u003cfaultrule name=\"VariableOfNonMsgType\"\u003e\u003c/faultrule\u003e\u003cFaultRule name=\"DeleteOAuthV2Info_Faults\"\u003e\n \u003cStep\u003e\n \u003cName\u003eAM-InvalidTokenResponse\u003c/Name\u003e\n \u003c/Step\u003e\n \u003cCondition\u003e(fault.name = \"invalid_access_token\")\u003c/Condition\u003e\n\u003c/FaultRule\u003e\n```\n\n\u003cbr /\u003e\n\nSchema\n------\n\nEach policy type is defined by an XML schema (`.xsd`). For reference, [policy schemas](https://github.com/apigee/api-platform-samples/tree/master/schemas/policy)\nare available on GitHub.\n\nRelated topics\n--------------\n\n- [OAuthV2 policy](/apigee/docs/api-platform/reference/policies/oauthv2-policy)\n- [OAuth home](/apigee/docs/api-platform/security/oauth/oauth-home)\n- [Customizing Tokens\n and Authorization Codes](/apigee/docs/api-platform/security/oauth/customizing-access-tokens)"]]