Forum Discussion
gregarican
Mar 11, 2021Copper Contributor
Graph API request doesn't even send out.
So I am using the latest Microsoft.Graph NuGet package in a VS 2019 project. Looking to create a new calendar event. The API request doesn't even send out, although if I place the same JSON request b...
- Mar 12, 2021Disregard. This all was being called as a static method from my main program. I forgot to grab the created calendar event ID with the .Result suffix. Since it's awaiting. Duh.
gregarican
Mar 12, 2021Copper Contributor
I can tell this the ConfidentialClientApplicationBuilder code section is where it's failing. Based on that class instance I cannot hook into anything, whether through the GraphServiceClient or the GraphClientFactory.Create() that spins up an HttpClient. I have verified that my clientId, tenantId, and clientSecret are valid in the Azure app registration page. And I've also tried to acquire a token, as part of the process (which I previously didn't have to do when my project was working).
string[] scopes = new string[] { "https://graph.microsoft.com/.default" };
AuthenticationResult result = null;
try
{
result = await confidentialClientApplication.AcquireTokenForClient(scopes)
.ExecuteAsync();
}
catch (MsalServiceException ex)
{
// Case when ex.Message contains:
// AADSTS70011 Invalid scope. The scope has to be of the form "https://resourceUrl/.default"
// Mitigation: change the scope to be as expected
}
string[] scopes = new string[] { "https://graph.microsoft.com/.default" };
AuthenticationResult result = null;
try
{
result = await confidentialClientApplication.AcquireTokenForClient(scopes)
.ExecuteAsync();
}
catch (MsalServiceException ex)
{
// Case when ex.Message contains:
// AADSTS70011 Invalid scope. The scope has to be of the form "https://resourceUrl/.default"
// Mitigation: change the scope to be as expected
}
gregarican
Mar 12, 2021Copper Contributor
Disregard. This all was being called as a static method from my main program. I forgot to grab the created calendar event ID with the .Result suffix. Since it's awaiting. Duh.