This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private async Task<string> GetTokenAsync(string appId, X509Certificate2 certificate, string tenantId) | |
{ | |
var app = ConfidentialClientApplicationBuilder.Create(appId) | |
.WithAuthority($"https://login.microsoftonline.com/{tenantId}/") | |
.WithCertificate(certificate) | |
.Build(); | |
var scopes = new[] { "https://graph.microsoft.com/.default" }; | |
var result = await app.AcquireTokenForClient(scopes).ExecuteAsync(); | |
return result.AccessToken; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment