public async Task GetTokenAsync()

in src/Authentication/MsalServicePrincipalTokenProvider.cs [27:55]


        public async Task<AuthenticationResult?> GetTokenAsync(TokenRequest tokenRequest, CancellationToken cancellationToken = default)
        {
            try
            {
                if (!CanGetToken(tokenRequest))
                {
                    logger.LogTrace("InvalidInputs");
                    return null;
                }

                var app = ConfidentialClientApplicationBuilder.Create(tokenRequest.ClientId)
                    .WithHttpClientFactory(appConfig.HttpClientFactory)
                    .WithLogging(appConfig.LoggingCallback, appConfig.LogLevel, appConfig.EnablePiiLogging, appConfig.IsDefaultPlatformLoggingEnabled)
                    .WithCertificate(tokenRequest.ClientCertificate, sendX5C: true)
                    .WithTenantId(tokenRequest.TenantId)
                    .Build();

                var result = await app.AcquireTokenForClient(MsalConstants.AzureDevOpsScopes)
                    .ExecuteAsync()
                    .ConfigureAwait(false);

                return result;
            }
            catch (Exception ex)
            {
                logger.LogTrace(ex.Message);
                return null;
            }
        }