Invalid ApiKey for given resource

Not applicable

I have the xyz proxy in which I have 5 proxy endpoints. My requirement is to create a product which has xyz proxy and only give access to one end point. The base path of that endpoint is /v1/sso/health to which I want to give access. I have added the same in resource but I am getting error in response "Invalid ApiKey for given resource". It only works when I change the resource path to /. But changing resource path to / will allow access to all the endpoints in that proxy.

Any suggestions here.

0 6 1,957
6 REPLIES 6

Not applicable

Hello @Harshit ,

Have you verified that setting resource path to "/' allows accessing all endpoints. I feel, /**" means anything after "/" and "**"' would mean everything.

Please let me know, if you find a different result.

Yes setting resource path to / allowed me to access all the end points in proxy bundle. However I believe that if I restrict the resource path to the one proxy end point then it should allow access to that only but its not. Something wrong the way am providing the resource path I suspect.

Have you selected the / from the drop down or you added by your own ?

I have added it in custom resource

Are you able to run a bash script?

Attached please find a bash script that should

  • import an API proxy (it's embedded into the script)
  • deploy the proxy
  • create an API product, with resource paths /t1 and /t5
  • create a developer
  • create a developer app
  • retrieve the keys for the app
  • invoke the API proxy on path /t1 - it succeeds with 200 OK
  • invoke the API proxy on path /t2 - it succeeds with 401 Unauthorized

apiproductresourcedemo-provisionsh.zip

Run the script with the -r option to remove all the things it had created.

Thanks your inputs.

I believe the way product works, it includes base path in the Resource by default, which means “Resource Path” is the custom URI AFTER the base path. But in my case I have the bunch of endpoints with their unique base path. How can I change this behaviour while creating the product?

And on that bash script getting

"that org cannot be validated" Run the below command. Do I need to tune the script somewhere?

./apiProductResourceDemo-Provision.sh -m https://enterprise.apigee.com -o myOrgName -e test