If you are using the Apigee Cloud version of Edge, then you will see that a proxy called oauth is included in your organization by default. This proxy provides two sample endpoints for generating access and refresh tokens. If you'd like to learn more about OAuth token endpoints, see Understanding OAuth endpoints.
The client credentials grant type defines a procedure for issuing access tokens in exchange for app credentials. These app credentials are the consumer key and secret pair that Apigee Edge issues for each app that is registered in an organization. For more details, see Implementing the authorization code grant type.
Add OAuth 2.0 to a new API proxy
You can easily add OAuth verification to an API when you create a new API proxy.
Access the Create Proxy wizard, as described below.
To access the Create Proxy wizard using the Edge UI:
- Sign in to apigee.com/edge.
- Select Develop > API Proxies in the left navigation bar.
- Click + Proxy
Classic Edge (Private Cloud)
To access the Create Proxy wizard using the Classic Edge UI:
- Sign in to
http://ms-ip:9000, where ms-ip is the IP address or DNS name of the Management Server node.
- Select APIs > API Proxies in the top navigation bar.
- Click + API Proxy
Use the wizard to create a Reverse proxy. If you're not familiar with this dialog, see Build a simple API proxy. In the Security section of the wizard, select the radio button next to OAuth v2.0.
When you select this option, two policies will be attached to the newly created API proxy, one to verify access tokens and another to strip the access token after it has been verified.
Note that the Publish API Product checkbox becomes selectable and is automatically selected. Check this if you want to automatically generate a product when you build the new API proxy. The autogenerated product will be created with an association to the new API proxy. If you have an existing product with which you want to associate this new API, be sure to clear this checkbox so that you don't create an unnecessary product. For information about products, see What is an API product?
Working with the default OAuth proxy
The oauth proxy exposes the following endpoint URI:
Publish this URI to developers who need to obtain access tokens. App developers configure their apps to call this endpoint, presenting their consumer key and secret pairs to obtain access tokens.
The default client credentials token endpoint is exposed over the network at the following URL:
For example, if your organization name is "apimakers", the URL would be:
This is the URL that developers call to obtain access tokens.
Call the API
When you get back an access token, you can call the API with an Authorization header and Bearer token, like this:
curl -H "Authorization: Bearer <your access token>"
See also Verifying access tokens.