Using Windows Hello Authentication on HoloLens2

Damian Mavrudis 1 Reputation point
2020-06-16T19:36:33.917+00:00

Hello everyone.

I'm trying to use Windows Hello Authentication on my Unity/HoloLens2 App.
However I'm having problems with the very first step (checking availability), that's shown in Microsoft's example.
Link: https://learn.microsoft.com/en-us/windows/uwp/security/microsoft-passport-login

When calling Windows.Security.Credentials.KeyCredentialManager.IsSupportedAsync() the App loads a couple of dlls and just stops working.
It does not crash, no error messages. Just a couple of threads exiting with code 0x0 for many minutes (my longest test lasted about 15min, then I stopped the debugging).

Here is my C# code:

using System;  
using System.Threading.Tasks;  
using UnityEngine;  
#if WINDOWS_UWP  
using Windows.Security.Credentials;  
#endif  
  
namespace MyNamespace  
{  
    public static class KeyCredentialHelper  
    {  
        public static async Task<bool> CheckAvailabilityAsync()  
        {  
         bool available = false;  
#if WINDOWS_UWP  
         Debug.Log("pre await"); //Get's logged  
            available = await KeyCredentialManager.IsSupportedAsync(); //Application stops here  
         Debug.Log("post await"); //Doesn't get logged  
#else  
            Debug.Log("Only Available on UWP!");  
#endif  
            return available  
        }  
    }  
}  

I'm developing in Unity with the MixedReality Toolkit, so the compiler directives are necessary.

And here is the console output from within Visual Studio (after converting to c++):

pre await  
   
(Filename: C:\buildslave\unity\build\Runtime/Export/Debug.bindings.h Line: 45)  
  
'unity-project-authenticate.exe' (Win32): Loaded 'C:\Windows\SysArm32\CryptoWinRT.dll'.   
'unity-project-authenticate.exe' (Win32): Loaded 'C:\Windows\SysArm32\cryptngc.dll'.   
'unity-project-authenticate.exe' (Win32): Loaded 'C:\Windows\SysArm32\ncrypt.dll'.   
'unity-project-authenticate.exe' (Win32): Loaded 'C:\Windows\SysArm32\ntasn1.dll'.   
'unity-project-authenticate.exe' (Win32): Loaded 'C:\Windows\SysArm32\ngcksp.dll'.   

Again, there are no errors, the App "doesn't crash" (It stops working and displaying it's content, but doesn't close).
When I close and reopen the App, a larger version of the loading animation of the HoloLens2 is displayed on eyelevel, but nothing else happens.

Unity 2018.4.23f1

Visual Studio 2019

MRTK 2.4.0 (although this shouldn't have an effect)

What am I missing? Any help greatly appreciated!

Not Monitored
Not Monitored
Tag not monitored by Microsoft.
23,929 questions
No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Roy Li - MSFT 26,556 Reputation points Microsoft Employee
    2020-06-17T01:41:46.04+00:00

    Hello,

    Welcome to Microsoft Q&A!

    Currently, Microsoft Q&A supports the products listed over here: supported topics (more to be added later on).

    Your question about Unity and Hololens is not supported yet now. You could ask about this in StackOverflow with Hololens2 and Unity tag.

    Thank you.

    No comments