Mandrill-dotnet
Mandrill-dotnet copied to clipboard
Id = 14, Status = WaitingForActivation, Method = "{null}", Result = "{Not yet computed}"
I am trying to get AAD access token from Azure and i am getting WaitingForActivation message.. Am i doing something wrong.. Please help ... Thanks in Advance !!
public static async Task
string clientId = "Client Application ID";
string aadAudience = "https://login.microsoftonline.com/{Tanent ID}/oauth2/token";
var authCtx = new AuthenticationContext(authority);
// Load certificate from Disk
X509Certificate2 clientCert = new X509Certificate2(certificateLocation, certificatePassword);
var clientAssertion = new ClientAssertionCertificate(clientId, clientCert);
var authenticationResult = await authCtx.AcquireTokenAsync(aadAudience, clientAssertion);
if (authenticationResult == null)
{
throw new InvalidOperationException("Failed to obtain the token");
}
// contains the token
string accessToken = authenticationResult.AccessToken;
return accessToken;
}
You need to use await
keyword for async methods. You see this message because of Task doesn't run yet.
You need to use
await
keyword for async methods. You see this message because of Task doesn't run yet.
thanks, i used it and it worked