Auto/background refresh for WorkloadIdentity/TokenCredential
memoryz Thanks for resolving the issue with #191. Can you please implement auto/background refresh for WorkloadIdentity/TokenCredential, so that clients need not worry to refresh the token on expiry.
Pls refer line number 323 in the file : https://github.com/Azure/azure-cosmos-dotnet-v3/blob/dee9abaedf66b5663fdf33ea1f943cd9303e152a/Microsoft.Azure.Cosmos/src/CosmosClient.cs#L29
Hi @dineshtsm I'm a little confused by your ask. The implementation doesn't cache anything - it passed in a function to the HttpMessageHandler (BearerHeaderHandler.cs) used by the HttpClient:
var httpClient = CreateHttpClient(
baseUrl,
async () => (await credential.GetTokenAsync(new TokenRequestContext(new string[] { DatabricksScope }), default)).Token,
timeoutSeconds,
httpClientConfig
);
This means every time a request is issued, a new access token is requested on the spot. The clients don't need to refresh token since the clients don't even have access to the requested token.