【发布时间】:2021-06-08 18:04:58
【问题描述】:
我目前正在为 Hololens(第一代和第二代)开发 Unity 项目,我们的客户要求我们将应用程序集成到 Azure AD 中。
我们正在关注此tutorial。当我们调用 client.AcquireTokenAsync(Scopes);
方法时,下面的代码似乎无法正常工作bool authenticated = false;
PublicClientApplication client = new PublicClientApplication("*********-***-****-****-*********");
AuthenticationResult authResult = null;
IEnumerable<string> Scopes = new List<string> { "User.Read"};
try
{
authResult = await client.AcquireTokenAsync(Scopes);
authenticated = true;
}
catch (MsalException msaEx)
{
// Display some text like ($"Failed to acquire token: {msaEx.Message}");
}
catch (Exception ex)
{
// Display some text like ($"Failed to acquire token: {ex.Message}");
}
由于不明原因引发异常并显示以下消息:
- 反序列化类中的只读成员时出错:“Microsoft.Identity.Client.Internal.OAuth2.OAuth2ResponseBase”类型中的属性“Claims”没有设置方法。
我不太清楚为什么会抛出这个异常。
【问题讨论】:
标签: c# unity3d azure-active-directory msal hololens