Skip to content

Commit

Permalink
Merge pull request #415 from MicrosoftDocs/bgavrilMS-patch-1
Browse files Browse the repository at this point in the history
Update workload-identity-federation.md
  • Loading branch information
localden authored May 16, 2024
2 parents 7a36c77 + fc8058b commit 342d157
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@ using Microsoft.Identity.Client;
var app = ConfidentialClientApplicationBuilder
.Create(clientId)
.WithClientAssertion((AssertionRequestOptions options) => FetchExternalTokenAsync())
.WithCacheOptions(CacheOptions.EnableSharedCacheOptions) // for more cache options see https://learn.microsoft.com/entra/msal/dotnet/how-to/token-cache-serialization?tabs=msal
.Build()

var result = await app
.AcquireTokenForClient(scope).ExecuteAsync();
var result = await app.AcquireTokenForClient(scope).ExecuteAsync();

public async Task<string> FetchExternalTokenAsync()
{
// logic to get token from cache or other sources, like GitHub, Kubernetes, etc.
return token;
// Logic to get token from cache or other sources, like GitHub, Kubernetes, etc.
// Caching is the responsability of the implementer.
return token;
}

```
Expand Down

0 comments on commit 342d157

Please sign in to comment.