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.
We are following this tutorial . The code bellow doens't seem to work properly when we invoke the method 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'.
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'
The product team already replaced the serialization to use Newtonsoft internally to overcome these type of bugs.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.