vault backup: 2024-09-08 09:21:24
This commit is contained in:
parent
cb05b3e884
commit
d8c8ac4708
@ -4,4 +4,38 @@ email koopernikus@web.de
|
|||||||
telefonnummer 01607851441
|
telefonnummer 01607851441
|
||||||
|
|
||||||
URL
|
URL
|
||||||
https://claude.ai
|
https://claude.ai
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
using Microsoft.Graph;
|
||||||
|
using Microsoft.Identity.Client;
|
||||||
|
|
||||||
|
// ... (in Ihrer Funktionsmethode)
|
||||||
|
|
||||||
|
var clientId = Environment.GetEnvironmentVariable("CLIENT_ID");
|
||||||
|
var clientSecret = Environment.GetEnvironmentVariable("CLIENT_SECRET");
|
||||||
|
var tenantId = Environment.GetEnvironmentVariable("TENANT_ID");
|
||||||
|
|
||||||
|
var confidentialClientApplication = ConfidentialClientApplicationBuilder
|
||||||
|
.Create(clientId)
|
||||||
|
.WithClientSecret(clientSecret)
|
||||||
|
.WithAuthority(new Uri($"https://login.microsoftonline.com/{tenantId}/v2.0"))
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
var scopes = new[] { "https://graph.microsoft.com/.default" };
|
||||||
|
|
||||||
|
var authResult = await confidentialClientApplication.AcquireTokenForClient(scopes).ExecuteAsync();
|
||||||
|
|
||||||
|
var graphClient = new GraphServiceClient(new DelegateAuthenticationProvider(async (request) =>
|
||||||
|
{
|
||||||
|
request.Headers.Authorization = new HeaderStringValues($"Bearer {authResult.AccessToken}");
|
||||||
|
}));
|
||||||
|
|
||||||
|
// Beispiel für einen Graph-API-Aufruf
|
||||||
|
var user = await graphClient.Users["user@example.com"].Request().GetAsync();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#befehle #
|
Loading…
Reference in New Issue
Block a user