Skip to content

Optimize Token Fetch calls across multiple CosmosClient connections #4288

Closed Answered by kirankumarkolli
ajchalla asked this question in Q&A
Discussion options

You must be logged in to vote

TokenReqeustContext Cosmos SDK uses is for scope https://{endpointUri.Host}/.default
In-case multiple-CosmosClients are created for different accounts then the token will be different for each account.

Token caching:

  • SDK will not call TokenCredential for every request.
  • The token will be cached inside, SDK and refreshes will be attempted with-in token-lifetime to proactively refresh
    • Default policy: first attempt after 50% lifetime, like 50%, 75%, 87.5% etc...
    • Application can override it with CosmosClientOptions.TokenCredentialBackgroundRefreshInterval (fixed and not-dynamic)

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by ajchalla
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants