API management URL is giving Missing subscription key Issue

lokanath das picture lokanath das · Jul 25, 2018 · Viewed 17k times · Source

I am new to API management. I have created a Basic WEB API & hosted to the API APP(App service). URL is working as expected & it's returning the data. i.e. http://xyz.azurewebsites.net/api/webapi

But when I am adding the API App in the API management, I am getting different URL with Extra suffix I am adding, But when I am trying to open in browser Link--> https://abc.azure-api.net/God am getting the below error

{ "statusCode": 401, "message": "Access denied due to missing subscription key. Make sure to include subscription key when making requests to an API." }

If its no issue with API APP then it shouldn't be with API management. Please guid me if something I am missing.

NB--> I have tried adding the Subscription Key in fiddler its different issue is coming. but to access a URL it doesn't require Subscription Key basically.

Answer

VinuBibin picture VinuBibin · Jul 25, 2018

If you enable the option to Require subscription for the product settings, then you must pass the below header Ocp-Apim-Subscription-Key. Even you provide subscription key, the key should belong to the product which the API includes. If you don't want the subsciption option, disable it in the product settings.