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」範圍也試過,作爲守護程序樣本。