答案 0 :(得分:0)
我没有复制您的问题。这是我这一边的工作示例。
使用交互式身份验证提供程序
using Microsoft.Graph;
using Microsoft.Graph.Auth;
using Microsoft.Identity.Client;
using System;
namespace AzureTest
{
class Program
{
static void Main(string[] args)
{
string[] scopes = { "https://graph.microsoft.com/.default" };
IPublicClientApplication publicClientApplication = PublicClientApplicationBuilder
.Create("cbc3***-ac27-4532-802d-303998a6e712")
.Build();
InteractiveAuthenticationProvider authenticationProvider = new InteractiveAuthenticationProvider(publicClientApplication,scopes);
GraphServiceClient graphClient = new GraphServiceClient(authenticationProvider);
User me = graphClient.Me.Request()
.GetAsync().Result;
Console.Write(me.DisplayName);
}
}
}
使用机密客户端提供商
using Microsoft.Graph;
using Microsoft.Graph.Auth;
using Microsoft.Identity.Client;
using System;
namespace AzureTest
{
class Program
{
static void Main(string[] args)
{
string[] scopes = { "https://graph.microsoft.com/.default" };
IConfidentialClientApplication confidentialClientApplication = ConfidentialClientApplicationBuilder
.Create("")
.WithRedirectUri("")
.WithClientSecret("")
.Build();
}
}
}
更新:
搜索软件包时,您需要检查包括预发行版。