7 thoughts on “AAD Login on HoloLens 2

  1. Hi Pete,

    First of all thanks for this awesome tutorial, this is a topic rarely covered properly and you have done it very clearly.
    Could you please do a tutorial on using MSAL with Unity iOS or Android app?
    I have used both Amazon SDK and Firebase which integrate with AR/VR apps very easily.
    I don’t understand why Microsoft doesn’t provide the same level of flexibility in the MR space.

    1. I agree, and I think a sample/tutorial showing a VR/AR app accessing Azure services across platforms; iOS/Android/Windows MR/HoloLens/Windows Desktop would be really useful. If I get chance (I don’t think I will unfortunately) but would like to extend this sample (or a better scenario) to include those platforms and maybe discuss design decisions across those platforms. I wonder if the Azure Spatial Anchors samples might help as they are x-plat https://github.com/Azure/azure-spatial-anchors-samples.

  2. HI Pete, thank you for the detailed explanations on your tutorial.
    It helped me get through all the steps of deploying your sample app to HL2.

    I got an issue though when attempting AD authentication using MSAL.
    The app fails to show the interactive login dialog, and shows these errors instead (displayed on the main panel + UnityPlayer.log):

    [1]
    An error occurred while sending the request
    UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
    UnityEngine.Logger:Log(LogType, Object)
    UnityEngine.Debug:Log(Object)
    AuthManager:Log(String, Boolean)
    System.Threading.ThreadStart:Invoke()
    d__4:MoveNext()
    UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
    UnityEngine.MonoBehaviour:StartCoroutine_Auto(IEnumerator)
    System.Threading.ThreadStart:Invoke()
    UnityMainThreadDispatcher:Update()

    (Filename: C:\buildslave\unity\build\Runtime/Export/Debug/Debug.bindings.h Line: 35)

    [2]
    Object reference not set to an instance of an object.
    UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
    UnityEngine.Logger:Log(LogType, Object)
    UnityEngine.Debug:Log(Object)
    AuthManager:Log(String, Boolean)
    System.Threading.ThreadStart:Invoke()
    d__4:MoveNext()
    UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
    UnityEngine.MonoBehaviour:StartCoroutine_Auto(IEnumerator)
    System.Threading.ThreadStart:Invoke()
    UnityMainThreadDispatcher:Update()

    I contacted MS Support, they asked to upgrade MSAL from 4.9.0 to 4.29.0, which I did and I also tried other things like changing platform settings (under inspector / plugin). Did you run into these same issues?

    1. Hi Houssam,

      I don’t recall seeing similar issues, are you using the same MSAL version that I used in my sample? I just tried an old build of that sample with the latest insider OS and I see the dialog as expected.

      Could you find the full unity log from your HoloLens device and send to my email address in the about page of this blog?
      You can find the log using the HoloLens developer portal File Explorer with the path:

      User Folders\LocalAppData\\TempState\UnityPlayer.log
      (Terminate the app if it is running otherwise the log file won’t get flushed to disk).

      Pete

      1. I am using the same MSAL version that’s in your sample, which is 4.9.0.
        It is worth noting that MS Support asked me to upgrade it to 4.27+ because of a known issue in MSAL prior to 4.27. So I updated the MSAL under Plugins/MSAL/Placeholder to 4.29.0 and updated the platform settings to match your sample’s (Editor / Any CPU / Any OS). And I removed the one under Plugins/MSAL. Redeployed to HL2 and got the same exception.
        I will send the log shortly.
        Regards
        Houssam

  3. Hey! I’m till trying to get this working on my own project. Everything works in the editor, but when built to the device, Device Code Flow fails at the callback point with no error or exception thrown. (We’ve talked in the slack about it.)

    I went through several cycles of excluding everything I could from the code stripper as discussed above with no success in UWP (although that made the difference in a standalone build).

    Now I’m wondering about the two versions of the microsoft.identity.client you have in this project. What’s the difference and could that be causing my issue?
    Thanks

  4. Hi Pete,
    Great article. Thank you.
    When I try the example code in the github and test the WAM using Iris toggle on. When click Sign in => I don’t see the Credential Dialogue window show up? It stuck there and show these logs in the windows:
    Logging in with WebAuthenticationCoreManager…

    I did check Hololens Sign-in options in the settings and see it is as the picture shown in the article?
    Am I missing anything?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.