how can we implement VerifyApiKey in request preflow?

getting error while executing the proxy with verify apikey,passed the key as both query param and

header but getting the following error.

{ 
 "fault": {
  "faultstring": "Invalid ApiKey for given resource",
  "detail": {"errorcode": "oauth.v2.InvalidApiKeyForGivenResource"}
 }
}

The policy looks like:

<VerifyAPIKey name="verifyAPIKey">
 <DisplayName>verifyAPIKey</DisplayName>
 <Properties/>
 <APIKey ref="request.queryparam.client_id"/>
</VerifyAPIKey>
1 9 332
9 REPLIES 9

Not applicable

Based on the error message, it looks like the key is valid but not for the proxy being called. I would validate your product setup and make sure that the proxy being called is enabled for the product and developer app associated to this API key. Here are the specific notes on this error:

An API key was received by Edge, and it is valid; however, it does not match an approved key in the Developer App associated with your API proxy through a Product.

Here is the docs link for the Verify API Key policy that also has the details for this error: http://docs.apigee.com/api-services/reference/verify-api-key-policy

Yes, that sounds right! I think the issue is not related to the use of VerifyApiKey within the preflow. It just sounds like a Proxy / Product setup issue as Jessica explained.

Yeah,I included organization in product but still throwing the same error

Thank you very much for your suggestion its an error associated with my product. I am imported /** path instead of /

But what is the difference between /** and / of path section product

They are paths. The request path of / grants rights to the bare root path. The path /** grants rights to all paths, all levels.

This is described in the Apigee documentation in some good detail.

while i am configured a product by /** it throws error but i have only one path

/** grants access to all paths except the basepath - /v1/weatherapikey/1/ would be allowed but not /v1/weatherapikey, assuming /v1/weatherapikey is your proxy basepath.

I recommend reviewing the link Dino referenced, there are some examples that walk through the different request paths in detail.

I'm not clear, are you still having a problem? You are asking questions via new "Answers" and I'm not clear of the ordering. Jessica made the suggestion to get the product configured properly, and I have answered some of your other questions, but I'm not clear if any of this is helping. Or if you have even seen the information.

You are now saying "it throws error", but I'm not clear what error is being thrown, or under what circumstances the error is thrown, or if you have seen any of this information we have provided to you. Specifically the documentation link I cited, HERE http://docs.apigee.com/developer-services/content/creating-api-products#resourcebehavior answers the question you just asked. Have you seen it?

I want to help you but I'm struggling to understand what you are seeing, what the current state is, if you have understood the answers I have provided so far, if you have followed those suggestions, and so on.

If you reply to this comment, can you please use the "reply" button associated to this comment, rather than posting a new answer? That way we both will be able to follow the flow of the dialogue.