Send Docs Feedback

Note: Most user interface tasks can be performed in Edge Classic or the New Edge experience. For an overview, getting started topics, and release notes specific to the New Edge experience, see the docs.

Verifying access tokens

When you call an API proxy on Apigee Edge that has OAuth security, Edge is responsible for verifying access tokens. Think of Edge as the gatekeeper -- no API call can pass through that does not have an access token that can be verified. 

When verifying an access token, if you happen to see this error: "Invalid API call as no apiproduct match found", go to this Apigee Community article for details on the cause of this error and steps to correct it. 

Adding a VerifyAccessToken policy

To configure token verification, place an OAuthV2 policy with the VerifyAccessToken operation at the very beginning of the API proxy flow (the beginning of the ProxyEndpoint Preflow). If placed there, access tokens will be verified before any other processing takes place, and if a token is rejected, Edge stops processing and returns an error back to the client. 

  1. Log in to your Apigee Edge account.
  2. From the main menu, select APIs > API Proxies
  3. From the list, select the proxy you wish to protect.
  4. In the overview page, click DEVELOP
  5. In the Navigator, select PreFlow for an endpoint listed under Proxy Endpoints. Typically, the endpoint you want is called "default", although it is possible to create multiple proxy endpoints. If you do have multiple endpoints, you will probably want to follow these steps to perform token verification on each one.

  6. In the proxy flow editor, click + Step.

  7. Select Policy Instance New.
  8. From the policy list, select OAuth v2.0.
  9. Optionally, change the policy name and display name. For example, for better readability, you might change the display name and name both to "VerifyAccessToken".
  10. Click Add.

The default policy is already configured with the VerifyAccessToken operation, so you do not have to do anything further:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<OAuthV2 async="false" continueOnError="false" enabled="true" name="OAuth-v20-1">
    <DisplayName>OAuth v2.0 1</DisplayName>
    <GenerateResponse enabled="true"/>

By default, VerifyAccessToken expects the access token to be sent in an Authorization header as a Bearer token. For example:

-H "Authorization: Bearer Rft3dqrs56Blirls56a"

You can change this default in the <AccessToken>  element in the OAuthV2 policy, as explained in the policy documentation.


Help or comments?