Share via


API Management suddenly returning 401 Unauthorized error

Question

Wednesday, August 9, 2017 4:16 PM

We have an authenticator service (https://apidevidealab.azure-api.net/user/api/AuthenticateHandler) exposed through API MGMT that has been working fine until yesterday afternoon when suddenly started to return a 401 (We have not pushed new code or touched it since last week). We can see that the Azure function (Which is marked private) is never called from the API Mgmt so that is why we know the issue is in the API MGMT, we checked that the x-functions-key is set properly etc .... The only policy we had set is this one: 

<policies>
<inbound>
<cors>
<allowed-origins>
<origin>*</origin>
</allowed-origins>
<allowed-methods>
<!-- allow any -->
<method>*</method>
</allowed-methods>
<allowed-headers>
<!-- allow any -->
<header>*</header>
</allowed-headers>
</cors>
</inbound>
<backend>
<base />
</backend>
<outbound>
<base />
</outbound>
</policies>

We are running of ideas where to look at, especially since we have not touched this in few days and stopped suddenly working. Any ideas or tips will be appreciated

All replies (1)

Thursday, August 10, 2017 2:41 AM

401 unauthorized error occurs if the token is invalid or expired: /en-us/azure/api-management/api-management-advanced-policies#SetStatus.

Reference: /en-us/azure/api-management/api-management-sample-send-request#send-request.  

 

Do click on "Mark as Answer" on the post that helps you, this can be beneficial to other community members.