...
First you need to get bearer token:
Code Block |
---|
IConfidentialClientApplication app = ConfidentialClientApplicationBuilder.Create({ClientId}).WithTenantId({TenantId}).WithClientSecret({ClientSecret}).Build();
var token = await app.AcquireTokenForClient(new string[] {“ClientId/.default"}).ExecuteAsync(); |
Where ClientId
is ClientId of application which is trying to access DS API and ClientSecret
you can get in application Azure registration.
Or you can use DS ClientId
and ClientSecret
instead, which we can provide for you.
Then we need to add this token to HttpClient header:
Code Block |
---|
HttpClient _client;
_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); |
...