Jayavardhan Gange
Jayavardhan Gange

Reputation: 305

How long I can cache tokens and does Azure SDK cache tokens?

With reference to Azure Managed Service Identity docs for AppServices I have below questions.

  1. If I use REST API to get the access token, how long I can cache that token before getting new token for the same resource?
  2. There is an Azure SDK also to get the token; Does that cache tokens internally?

Upvotes: 0

Views: 293

Answers (1)

Charles Xu
Charles Xu

Reputation: 31414

  1. If I use REST API to get the access token, how long I can cache that token before getting a new token for the same resource?

The lifetime of the access token depends on what you set for your Tenant. And in default, it's an hour. But for the Managed Identity Service Principals, it does not support to configure the token lifetimes, so it's still the default time: an hour.

Note that currently we do not support configuring the token lifetimes for Managed Identity Service Principals.

You can get more details here.

  1. There is an Azure SDK also to get the token; Does that cache tokens internally?

The Azure SDK just provides the way to get the token and you need to keep it yourself. The SDK will not keep it.

Upvotes: 1

Related Questions