0
我正在尝试创建一个使用MSAL作为客户端凭据流的ASP.NET Core应用程序。PlatformPlugin异常使用ASP.NET中的MSAL获取仅应用程序令牌核心
NullReferenceException: Object reference not set to an instance of an object.
Microsoft.Identity.Client.Internal.PlatformPlugin.LoadPlatformSpecificAssembly()
身份验证此样品为蓝本:active-directory-dotnet-daemon-v2
我的应用程序:active-directory-dotnet-webapp-openidconnect-aspnetcore-v2
授权是该样品为蓝本
我试图获得访问令牌当出现以下情况例外已注册Mail.Read应用程序权限。下面是抛出异常的代码:
string authority = $"https://login.microsoftonline.com/{ tenantId }/v2.0";
ConfidentialClientApplication client = new ConfidentialClientApplication(
authority,
appId,
redirectUri,
new ClientCredential(appSecret),
null);//new TokenCache());
AuthenticationResult authResult = await client.AcquireTokenForClient(
new string[] { "Mail.Read" }, null);
return authResult.Token;
与“https://graph.microsoft.com/.default”范围也试过,作为守护程序样本。