Azure APIM get-authorization-context returns cached expired token

EdmondTangCPower-2520 20 Reputation points
2025-01-11T20:59:43.0366667+00:00

I have a credential provider with two connections setup identically, however the original connection began to return an expired token a month ago and has been doing that ever since with the exact same issued and expiration date of when this problem first started. Here is the snippet of the APIM trace from the problematic connection:

User's image

What I've noticed comparing the traces between the connections is the non-problematic connection is taking additional steps to obtain the managed identity token, then sending the request to the authorization provider gateway. I've deleted the credential provider and connection and recreated with the same name and it's still returning the same dates. Any input would be greatly appreciated. Thanks!

The inbound policy. User's image

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
2,319 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Ranashekar Guda 575 Reputation points Microsoft External Staff
    2025-03-03T12:31:56.4666667+00:00

    Hi @EdmondTangCPower-2520,

    To compare the configurations, use Azure Resource Explorer or export them to JSON files and compare with a diff tool. You can also use Terraform’s terraform plan and terraform show commands.

    Regarding authorization requests, each API Management (APIM) request needing authorization counts as one. If your APIM instance is handling over 600 requests per minute, consider using the limit-concurrency policy to avoid overloading the authorization provider.

    In the ClientCredentials flow, refresh tokens aren't issued. Instead, the client should request a new access token when the current one expires.

    I hope this clarifies your issue. Feel free to reach out if you have any further concerns.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.