Hololens – UserConsentVerifier not working on Hololens 1st Generation

  authentication, c++, hololens, unity3d, windows

I’m currently working on an Hololens app that should work on both Hololens 1st gen and 2. One of the security requirements we have is to request user consent (using windows hello) before the app loads.

I’ve implementented a very similar approach to the following described here (https://docs.microsoft.com/en-us/uwp/api/Windows.Security.Credentials.UI.UserConsentVerifier?redirectedfrom=MSDN&view=winrt-19041):

private async System.Threading.Tasks.Task<string> RequestConsent(string userMessage)
{
    string returnMessage;

    if (String.IsNullOrEmpty(userMessage))
    {
        userMessage = "Please provide fingerprint verification.";
    }

    try
    {
        // Request the logged on user's consent via fingerprint swipe.
        var consentResult = await Windows.Security.Credentials.UI.UserConsentVerifier.RequestVerificationAsync(userMessage);

        switch (consentResult)
        {
            case Windows.Security.Credentials.UI.UserConsentVerificationResult.Verified:
                returnMessage = "Fingerprint verified.";
                break;
            case Windows.Security.Credentials.UI.UserConsentVerificationResult.DeviceBusy:
                returnMessage = "Biometric device is busy.";
                break;
            case Windows.Security.Credentials.UI.UserConsentVerificationResult.DeviceNotPresent:
                returnMessage = "No biometric device found.";
                break;
            case Windows.Security.Credentials.UI.UserConsentVerificationResult.DisabledByPolicy:
                returnMessage = "Biometric verification is disabled by policy.";
                break;
            case Windows.Security.Credentials.UI.UserConsentVerificationResult.NotConfiguredForUser:
                returnMessage = "The user has no fingerprints registered. Please add a fingerprint to the " +
                                "fingerprint database and try again.";
                break;
            case Windows.Security.Credentials.UI.UserConsentVerificationResult.RetriesExhausted:
                returnMessage = "There have been too many failed attempts. Fingerprint authentication canceled.";
                break;
            case Windows.Security.Credentials.UI.UserConsentVerificationResult.Canceled:
                returnMessage = "Fingerprint authentication canceled.";
                break;
            default:
                returnMessage = "Fingerprint authentication is currently unavailable.";
                break;
        }
    }
    catch (Exception ex)
    {
        returnMessage = "Fingerprint authentication failed: " + ex.ToString();
    }

    return returnMessage;}

Everithin works fine on Hololens 2 although on Hololens 1 for no clear reason I get the following exception on this line:

var consentResult = await Windows.Security.Credentials.UI.UserConsentVerifier.RequestVerificationAsync(userMessage);

{"No more data is available. (Exception from HRESULT: 0x8009002A)"}

I wonder if I’m doing something wrong or if this API does not support Hololens 1st generation at all. Although the class descrition says it supports all kind of verifications:

  • Checks for availability of a verification device (such as a Microsoft
    Passport PIN, Windows Hello biometric, or fingerprint reader) and
    performs a verification.

Source: Windows Questions

LEAVE A COMMENT