# Oauth2.0 Access Token Verification throws “Invalid API call as no apiproduct match found” error

**URL:** <https://discuss.google.dev/t/oauth2-0-access-token-verification-throws-invalid-api-call-as-no-apiproduct-match-found-error/17064>\
**Category:** Knowledge Hub\
**Tags:** apigee\
**Created:** [July 9, 2015, 9:00am UTC](https://discuss.google.dev/t/oauth2-0-access-token-verification-throws-invalid-api-call-as-no-apiproduct-match-found-error/17064 "2015-07-09T09:00:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![adevegowda](https://d3byx8b92xw3lq.cloudfront.net/user_avatar/discuss.google.dev/adevegowda/32/93606_2.png) [@adevegowda](https://discuss.google.dev/u/adevegowda)\
**Post date:** [July 9, 2015, 9:00am UTC](https://discuss.google.dev/t/oauth2-0-access-token-verification-throws-invalid-api-call-as-no-apiproduct-match-found-error/17064/1 "2015-07-09T09:00:12Z")

</div>

When using Oauth2.0, one of the errors observed is:

_{“fault”:{“faultstring”:“Invalid API call as no apiproduct match found”,“detail”:{“errorcode”:“keymanagement.service.InvalidAPICallAsNoApiProductMatchFound”}}}_

I would like to explain here a few possible causes for this error with the help of an example.

**Example**

Let’s say we have the Environment, API Proxies, Products, Developer Apps and Developer setup in an org “sample” as shown below:

**Environments**

test

prod

**API Proxies**

API\_One deployed in prod and test environments

API\_Two deployed in prod and test environments

**Products**

Product\_One associated with API\_One. Product\_One is enabled for test environment only.

Product\_Two associated with API\_Two. Product\_Two is enabled for prod environment only.

**DeveloperApps**

App\_One associated with Product\_One

App\_Two associated with Product\_Two

**Developers**

Dev\_One associated with App\_One

Dev\_Two associated with App\_Two

With this setup, we can get the “Invalid API call as no apiproduct match found” error with the following scenarios listed below:

**Scenario 1**

- Generate the access token by using the Client\_ID/Client\_Secret from “App\_Two”
- Run the API call for “API\_One” with the above generated access token

In this scenario, we are using the access token generated for App\_Two that is linked with Product\_Two /API\_Two to run the API call for API\_One. This is a clear mismatch.

**Scenario 2**

- Generate the access token by using the Client\_ID/Client\_Secret from “App\_One”
- Run the API call for “API\_One” with the above generated access token for prod environment

In this scenario, we are using the access token generated for App\_One in prod environment. However, the App\_One is associated with Product\_One, which is enabled only for test environment for the APIProxy “API\_One”. This is a clear mismatch.

In summary, here are a few possible causes for the error “Invalid API call as no apiproduct match found" when using OAuth2.0

1. **Access token generated with Client\_ID/Client\_Secret from a DeveloperApp-Product unrelated to an API Proxy**
2. **Access token generated with Client\_ID/Client\_Secret from a Product-DeveloperApp unrelated to environment in which the API call is tested**

**Solution**

To avoid the error“Invalid API call as no apiproduct match found", we need to

- Generate the access token using the **Client\_ID/Client\_Secret** from the DeveloperApp-Product associated with a specific API Proxy
- Use the generated access token to run the API call for the specific API Proxy in the specific environment (s) in which the Product is enabled.

In the example quoted above, we should do the following to avoid the error“Invalid API call as no apiproduct match found"

- Generate the access token using the **Client\_ID/Client\_Secret** from the DeveloperApp “App\_One”.
- App\_One is associated with Product\_One (enabled in test environment), which is further associated with API\_One proxy.
- Run the API call with the generated access for API\_One proxy only in test environment.

---

<div class="post-metadata">

**Author:** ![anonymous8](https://avatars.discourse-cdn.com/v4/letter/a/7cd45c/32.png) [@anonymous8](https://discuss.google.dev/u/anonymous8)\
**Post date:** [April 10, 2018, 11:48am UTC](https://discuss.google.dev/t/oauth2-0-access-token-verification-throws-invalid-api-call-as-no-apiproduct-match-found-error/17064/2 "2018-04-10T11:48:30Z")

</div>

This same error will also be seen in cases where the API Product approval type is set to ‘Manual’ and the Product has not been approved in the App yet.

So Basically :

1. Create Proxy, secure it with OAuth2.0 VerifyAccessToken

2. Create Product, add the proxy to generate token and the api proxy to be secured (created in 1). Set the approval as ‘Manual’

3. Create App, add above product to app.

4. Generate Token.

5. Send request to protected API Proxy with token genrated in (4).

6. Get ‘`InvalidAPICallAsNoApiProductMatchFound’```

7. Go to App-\>Edit-\>Approve the product-\>Save

8. Send request to protected API Proxy with token genrated in (4)

9. Watch in satisfaction/frustration/relief as OAuth token verification is successful
