Skip to content

Commit f5ebf1a

Browse files
authored
Fixed alignment
1 parent 7706c9d commit f5ebf1a

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

CloudAppSecurityDocs/api-authentication-application.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -167,25 +167,25 @@ See [Microsoft Authentication Library (MSAL) for Python](https://github.com/Azur
167167
1. Set TENANT_ID to the Azure tenant ID of the customer that wants to use your app to access Defender for Cloud Apps.
168168
1. Run the following command:
169169
170-
```curl
171-
curl -i -X POST -H "Content-Type:application/x-www-form-urlencoded" -d "grant_type=client_credentials" -d "client_id=%CLIENT_ID%" -d "scope=05a65629-4c1b-48c1-a78b-804c4abdd4af/.default" -d "client_secret=%CLIENT_SECRET%" "https://login.microsoftonline.com/%TENANT_ID%/oauth2/v2.0/token" -k
172-
```
170+
```curl
171+
curl -i -X POST -H "Content-Type:application/x-www-form-urlencoded" -d "grant_type=client_credentials" -d "client_id=%CLIENT_ID%" -d "scope=05a65629-4c1b-48c1-a78b-804c4abdd4af/.default" -d "client_secret=%CLIENT_SECRET%" "https://login.microsoftonline.com/%TENANT_ID%/oauth2/v2.0/token" -k
172+
```
173173

174-
You get an answer in the following form:
174+
You get an answer in the following form:
175175

176-
```output
177-
{"token_type":"Bearer","expires_in":3599,"ext_expires_in":0,"access_token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIn <truncated> aWReH7P0s0tjTBX8wGWqJUdDA"}
178-
```
176+
```output
177+
{"token_type":"Bearer","expires_in":3599,"ext_expires_in":0,"access_token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIn <truncated> aWReH7P0s0tjTBX8wGWqJUdDA"}
178+
```
179179

180180
## Validate the token
181181

182182
Ensure that you got the correct token:
183183

184184
1. Copy and paste the token you got in the previous step into [JWT](https://jwt.ms) in order to decode it.
185-
1. Validate that you get a 'roles' claim with the desired permissions
185+
1. Validate that you get a 'roles' claim with the desired permissions.
186186
1. In the following image, you can see a decoded token acquired from an app with permissions to all Microsoft Defender for Cloud Apps roles:
187187

188-
:::image type="content" source="media/api-authentication-application/webapp-decoded-token.png" alt-text="Screenshot that shows the decoded token.":::
188+
:::image type="content" source="media/api-authentication-application/webapp-decoded-token.png" alt-text="Screenshot that shows the decoded token.":::
189189

190190

191191
## Use the token to access Microsoft Defender for Cloud Apps API
@@ -194,19 +194,19 @@ Ensure that you got the correct token:
194194
1. Set the authorization header in the http request you send to "Bearer {token}" (Bearer is the authorization scheme).
195195
1. The expiration time of the token is one hour. You can send more than one request with the same token.
196196

197-
The following is an example of sending a request to get a list of alerts **using C#**:
198-
199-
```C#
200-
var httpClient = new HttpClient();
201-
202-
var request = new HttpRequestMessage(HttpMethod.Get, "https://portal.cloudappsecurity.com/cas/api/v1/alerts/");
203-
204-
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
205-
206-
var response = httpClient.SendAsync(request).GetAwaiter().GetResult();
207-
208-
// Do something useful with the response
209-
```
197+
The following is an example of sending a request to get a list of alerts **using C#**:
198+
199+
```C#
200+
var httpClient = new HttpClient();
201+
202+
var request = new HttpRequestMessage(HttpMethod.Get, "https://portal.cloudappsecurity.com/cas/api/v1/alerts/");
203+
204+
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token);
205+
206+
var response = httpClient.SendAsync(request).GetAwaiter().GetResult();
207+
208+
// Do something useful with the response
209+
```
210210

211211
## See also
212212

0 commit comments

Comments
 (0)