[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-08-18 UTC。"],[[["\u003cp\u003eThis page outlines how to set up OAuth2 endpoints in Apigee and Apigee hybrid for clients to request tokens and authorization codes.\u003c/p\u003e\n"],["\u003cp\u003eAn OAuth2 endpoint is a specific URL that clients use to call and request OAuth tokens or authorization codes, as demonstrated by the provided example.\u003c/p\u003e\n"],["\u003cp\u003eAn OAuthV2 policy, such as the "GenerateAccessToken" policy example, is needed to process token requests and must support the required grant type, like "client_credentials".\u003c/p\u003e\n"],["\u003cp\u003eThe example endpoint configuration shows a flow that executes the "GenerateAccessToken" policy when the correct path and HTTP verb are used, and this will return an access token to the client if they provide correct credentials.\u003c/p\u003e\n"],["\u003cp\u003eThe referenced page "Get OAuth 2.0 tokens" provides detailed information on all of the supported grant types.\u003c/p\u003e\n"]]],[],null,["# Understanding OAuth endpoints\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\nTo do its job as an OAuth2 authorization server, Apigee needs to expose endpoints\nwhere clients can request tokens and auth codes. This topic offers a quick\nintroduction to these endpoints, and shows you how to set them up in Apigee.\n\nWhat is an OAuth2 endpoint?\n---------------------------\n\nAn OAuth2 endpoint is a URL that clients call to request OAuth tokens (or auth codes). Here's an\nexample request for an access token: \n\n```\n$ curl -i -H \"ContentType: x-www-form-urlencoded\" \\\n-X POST \"https://apitest.acme.com/oauth/client_credential/accesstoken\" \\\n-d \"grant_type=client_credentials\" \\\n-H \"Authorization: Basic c3FIOG9vSGV4VHo4QzAySVg5T1JvNnJoZ3ExaVNyQWw6WjRsanRKZG5lQk9qUE1BVQ\"\n```\n\nYou need an OAuthV2 policy to process this request. As you can\ninfer from the above example request, the policy must support the \"client credentials\" grant type, and\nexecute on the path `/oauth/client_credentials/accesstoken`.\n\nThis is a sample OAuthV2 policy that is configured to accept the\n`client_credentials` grant type. For information on optional configuration elements\nthat you can configure with this policy, see [OAuthV2 policy](/apigee/docs/api-platform/reference/policies/oauthv2-policy). \n\n```scdoc\n\u003cOAuthV2 name=\"GenerateAccessToken\"\u003e\n \u003cOperation\u003eGenerateAccessToken\u003c/Operation\u003e\n \u003cExpiresIn\u003e1800000\u003c/ExpiresIn\u003e \u003c!-- 30 minutes --\u003e\n \u003cSupportedGrantTypes\u003e\n \u003cGrantType\u003eclient_credentials\u003c/GrantType\u003e\n \u003c/SupportedGrantTypes\u003e\n \u003cGenerateResponse enabled=\"true\"/\u003e\n\u003c/OAuthV2\u003e\n```\n\nHere's a sample endpoint configuration for generating an access token. It'll execute the\nGenerateAccessToken policy, which must be configured to support the client_credentials grant\ntype. \n\n```text\n...\n \u003cFlow name=\"generate-access-token\"\u003e\n \u003cRequest\u003e\n \u003cStep\u003e\n \u003cName\u003eGenerateAccessToken\u003c/Name\u003e\n \u003c/Step\u003e\n \u003c/Request\u003e\n \u003cResponse/\u003e\n \u003cCondition\u003e(proxy.pathsuffix MatchesPath \"/token\") and (request.verb = \"POST\")\u003c/Condition\u003e\n \u003c/Flow\u003e\n...\n```\n\nIf the client provides the correct credentials, the policy generates and returns a token; otherwise,\nit returns an error.\n\nRelated topics\n--------------\n\nFor detailed information on all of the supported grant types and sample code, see [Get OAuth 2.0 tokens](/apigee/docs/api-platform/security/oauth/access-tokens)"]]