I seem to be unable to restrict my API Products to portions of my proxy, using paths + proxy. My use case is very similar to this article, with the slight difference that I have a defined base path, rather than using a wildcard. I’ve generalized details somewhat, but below is the basic form of my proxy.
- /resource1
- /resource2
- /resource3
Each endpoint is defined separately, in the same proxy (rather than in a single default ProxyEndpoint XML file). The first 2 endpoints support creation of objects with a POST on their basepath and payload in the request body, retrieval of objects with a GET /{id} operation, and some operations on a given object, with the form POST /{id}/operation. The third resource has several sub-resources, each of which support CRUD operations.
My proxy uses a Shared Flow to validate the OAauth2 token, among other things. This verification occurs in the first step of each endpoint’s Preflow.
I have defined an API product that includes this proxy by name, and also specifically defined /resource1 as the resource path. After creating a developer, a developer app, and then assigning the API product to this developer app (and double-checking that it is approved), any POST /resource1 responds with the error “Invalid API call as no apiproduct match found.”
I tried several variations on this, including separately defining each subpath for /resource1
- /resource1
- /resource1/*
- /resource1//
I also tried only defining the product using paths, and no proxy. Because my proxy’s basepath is /v1/, I tried both
- /v1/resource1
- /v1/resource2
- /v1/resource3
and
- /resource1
- /resource2
- /resource3
However all of these configurations result in the same error for me. In fact, the only way I am able to allow access to /resource1 for an API Product is by allowing access to all resources for the proxy, using path /.
Does anyone have any advice that they could offer, to help resolve this issue? Am I missing something very basic? Should I move my OAuth token verification out of the shared flow, and why would that matter, if I should?
Thanks!