【问题标题】:Hololens (1st and 2nd gen) Unity App - Integrate with Azure ADHololens(第一代和第二代)Unity 应用程序 - 与 Azure AD 集成
【发布时间】: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


    【解决方案1】:

    请查看这个已解决的问题:MSAL running on HoloLens Unity app generates deserialization error: No set method for property 'Claims' in type 'Microsoft.Identity.Client.OAuth2.OAuth2ResponseBase'

    产品团队已经替换了序列化以在内部使用 Newtonsoft 来克服这些类型的错误。

    【讨论】:

      猜你喜欢
      • 2011-08-05
      • 2021-05-22
      • 1970-01-01
      • 1970-01-01
      • 2012-09-28
      • 1970-01-01
      • 2021-09-05
      • 1970-01-01
      • 2023-03-09
      相关资源
      最近更新 更多