EWS验证:具有服务帐户的OAuth

时间:2020-09-16 00:05:14

标签: oauth exchangewebservices

从本地计算机运行应用程序时,我具有以下代码,并且工作正常。

但是使用服务帐户运行同一应用程序时,我遇到了异常

// Configure the MSAL client to get tokens
var app = ConfidentialClientApplicationBuilder
    .Create(ConfigurationManager.AppSettings["appId"])
    .WithAuthority(AzureCloudInstance.AzurePublic, ConfigurationManager.AppSettings["tenantId"])
    .WithClientSecret(ConfigurationManager.AppSettings["clientSecret"]).Build();

// The permission scope required for EWS access
var ewsScopes = new string[] { "https://outlook.office.com/.default" };

//Make the toekn request
AuthenticationResult authResult = await app.AcquireTokenForClient(ewsScopes).ExecuteAsync();


Exception : An error occurred while sending the request. at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task

出现异常 AuthenticationResult authResult =等待应用程序。AcquireTokenForClient(ewsScopes).ExecuteAsync();

预先感谢

关于, Nidheesh

0 个答案:

没有答案