I am trying to work with graph API.
When I try to get the token, using the following code, on Winform application everything is working,
where running the same code from VSTO outlook adding, I get An error occurred while sending the request - An existing connection was forcibly closed by the remote host
what am I missing? or doing wrong?
the code is:
var app = PublicClientApplicationBuilder.Create(ThisAddIn.clientId).WithRedirectUri("http://localhost").Build();
string[] scopes = new string[] { "User.Read" };
var accounts = await app.GetAccountsAsync();
AuthenticationResult result = null;
try
{
result = await app.AcquireTokenInteractive(scopes).ExecuteAsync(); // hear i get the error
} catch (Exception ex)
{ MessageBox.Show($"Error: {ex.Message}"); }