An API that connects multiple Microsoft services, enabling data access and automation across platforms
HI @Anonymous
i can share my code for generate token with c#
private const string clientID = "xxxxxxxxxxxxxxxxxxx";
private const string aadInstance = "https://login.microsoftonline.com/{0}";
private const string tenant = "contosoexampledomainclient.onmicrosoft.com";
private const string resource = "https://graph.windows.net/";
private const string appKey = "xxxxxxxxxxxxxxxxxxx";
static string authority = string.Format(CultureInfo.InvariantCulture, aadInstance, tenant);
private static HttpClient httpClient = new HttpClient();
var app = ConfidentialClientApplicationBuilder.Create(clientID)
.WithLegacyCacheCompatibility(false)
.WithAuthority(authority)
.WithClientSecret(appKey)
.Build();
var scopes = new[] { "https://graph.microsoft.com/.default" };
var result = await app.AcquireTokenForClient(scopes).ExecuteAsync();
var url = "";
string teamsApps = null;
var httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.Accept.Clear();
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", result.AccessToken);
url = ("https://graph.microsoft.com/beta/appCatalogs/teamsApps");
var getResult = await httpClient.GetAsync(url);
teamsApps = await getResult.Content.ReadAsStringAsync();
In getResult you found the result of get API Microsoft.
With httpClient you found the token of microsoft.
Note important: appKey = AppSecret in azure.
If the reply is helpful, please click Accept Answer and kindly upvote it.