An error occurred while sending the request exception while AcquireTokenForClient

  • Thread starter Thread starter Nidh2390
  • Start date Start date
N

Nidh2390

Guest
Hi team,

I am getting an exception while running the below code from server

var ewsScopes = new string[] { "Sign in to Outlook" };

var app = ConfidentialClientApplicationBuilder.Create(ConfigurationManager.AppSettings["appId"])
.WithAuthority(AzureCloudInstance.AzurePublic, ConfigurationManager.AppSettings["tenantId"])
.WithClientSecret(ConfigurationManager.AppSettings["clientSecret"])
.Build();

AuthenticationResult result = null;
try
{

result = await app.AcquireTokenForClient(ewsScopes).ExecuteAsync();
}
catch (Exception ex1)
{
throw ex1;
}

Exception : An error occurred while sending the request


And this on result = await app.AcquireTokenForClient(ewsScopes).ExecuteAsync(); line.

Please note : the code is running fine when the application is running with AD users - only getting exception when i use a service account.


Regards,

Nidheesh

Continue reading...
 
Back
Top