From 166d72abb5263c2f61a43babebefbfeab0e1b9ff Mon Sep 17 00:00:00 2001 From: Joey Caparas Date: Wed, 16 Oct 2019 11:14:27 -0700 Subject: [PATCH] update code block --- .../microsoft-defender-atp/pull-alerts-using-rest-api.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/windows/security/threat-protection/microsoft-defender-atp/pull-alerts-using-rest-api.md b/windows/security/threat-protection/microsoft-defender-atp/pull-alerts-using-rest-api.md index 3395bce7c7..e52e94be42 100644 --- a/windows/security/threat-protection/microsoft-defender-atp/pull-alerts-using-rest-api.md +++ b/windows/security/threat-protection/microsoft-defender-atp/pull-alerts-using-rest-api.md @@ -178,10 +178,11 @@ Here is an example return value: The following code example demonstrates how to obtain an access token and call the Microsoft Defender ATP API. ```csharp -AuthenticationContext context = new AuthenticationContext(string.Format("https://login.windows.net/{0}/oauth2", tenantId)); +AuthenticationContext context = new AuthenticationContext(string.Format("https://login.windows.net/{0}", tenantId)); ClientCredential clientCredentials = new ClientCredential(clientId, clientSecret); -AuthenticationResult authenticationResult = context.AcquireToken(resource, clientCredentials); +AuthenticationResult authenticationResult = context.AcquireTokenAsync(detectionsResource, clientCredentials).GetAwaiter().GetResult(); ``` + ### Use token to connect to the detections endpoint ```