简体   繁体   English

Hololens(第一代和第二代)Unity 应用程序 - 与 Azure AD 集成

[英]Hololens (1st and 2nd gen) Unity App - Integrate with Azure AD

I'm currently working on a Unity Project for Hololens (1st and 2nd gen), our client asked us to integrate the app within the Azure AD.我目前正在为 Hololens(第一代和第二代)开发 Unity 项目,我们的客户要求我们将应用程序集成到 Azure AD 中。

We are following this tutorial .我们正在关注本教程 The code bellow doens't seem to work properly when we invoke the method client.AcquireTokenAsync(Scopes);当我们调用方法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}");
}

For no clear reason an exception is thrown with the following message:没有明确的原因会引发异常,并显示以下消息:

- Error on deserializing read-only members in the class: No set method for property 'Claims' in type 'Microsoft.Identity.Client.Internal.OAuth2.OAuth2ResponseBase'. - 反序列化 class 中的只读成员时出错:“Microsoft.Identity.Client.Internal.OAuth2.OAuth2ResponseBase”类型中的属性“声明”没有设置方法。

It's not really clear for me why this exception is being thrown.我不太清楚为什么会抛出这个异常。

Please check out this resolved issue: MSAL running on HoloLens Unity app generates deserialization error: No set method for property 'Claims' in type 'Microsoft.Identity.Client.OAuth2.OAuth2ResponseBase'请查看此已解决的问题: 在 HoloLens Unity 应用程序上运行的 MSAL 生成反序列化错误:在类型“Microsoft.Identity.Client.OAuth2.OAuth2ResponseBase”中没有设置属性“声明”的方法

The product team already replaced the serialization to use Newtonsoft internally to overcome these type of bugs.产品团队已经替换了序列化以在内部使用 Newtonsoft 来克服这些类型的错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM