Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

oauth.v2.InvalidApiKeyForGivenResource

Former Member
0 Kudos

Dear Experts,

I had a working scenario fetching ODATA service from backend and with couple of other policies added. This is on HCP Trial account.

I added the Verify API Key Policy and things stopped working.

My XML for the policy says >>

<!--Specify in the APIKey element where to look for the variable containing the api key-->

<VerifyAPIKey async='true' continueOnError='false' enabled='true'

xmlns='http://www.sap.com/apimgmt'>

  <APIKey ref='request.header.APIKey'/>

</VerifyAPIKey>

And I am sending a HTTP Header called APIKey using postman / also from a Java program.

This fails with an error as below.

{

  "fault": {

    "faultstring": "Invalid ApiKey for given resource",

    "detail": {

      "errorcode": "oauth.v2.InvalidApiKeyForGivenResource"

    }

  }

}

the Application Key is the exact value copied from the Dev portal , I also tried regenerating and using the new value but the error still occurs. Did also change the name of the header both in policy and in the client(postman / java code) but that does not help either.

Any clues?

Thanks,

Amol

  • SAP Managed Tags:
1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Amol,

as just discussed: exporting and importing the API Proxy resolved the issue. Now the API Key Policy is working as expected.

Regards,

Holger.

  • SAP Managed Tags:
2 REPLIES 2

Former Member
0 Kudos

Hi Amol,

as just discussed: exporting and importing the API Proxy resolved the issue. Now the API Key Policy is working as expected.

Regards,

Holger.

  • SAP Managed Tags:

0 Kudos

Thanks a lot Holger for your quick help . Have a nice week end.

Best Regards,

Amol

  • SAP Managed Tags: