Skip to content

Latest commit

 

History

History
33 lines (21 loc) · 2.41 KB

README.md

File metadata and controls

33 lines (21 loc) · 2.41 KB

MSAL HoloLens

Use Microsoft Auth Library to login to Microsoft Graph API using AAD V2 (either personal MSA or organization login credentials) on #HoloLens see http://peted.azurewebsites.net/microsoft-graph-auth-on-hololens/ for further details.

The original version is tagged here https://github.com/peted70/msal-hololens/tree/v1.0

The project uses the Mixed Reality Toolkit as a git submodule. To clone you can use the following command:

git clone --recurse-submodules https://github.com/peted70/msal-hololens.git

and then to create a symbolic link from the location of the MRTK on disk to the Assets folder in the Unity project use:

mklink /j .\Assets\HoloToolkit .\MixedRealityToolkit-Unity\Assets\HoloToolkit

The current master branch has moved on to include a device code flow which AAD has subsequently added support for. See https://oauth.net/2/grant-types/device-code/. The device code flow allows login from a device that doesn't have a browser so the flow will wait whilst the user logs ion from another device such as a mobile phone.

**Note that this doesn't currently work with a personal account. Note also that in order to achieve compatibility between the HoloLens app generated by Unity version 2018.2.15f1 and the latest Microsoft.Client.Identity library 2.5.0-preview I needed to upgrade the Microsoft.NETCore.UniversalWindowsPlatform Nuget to v6.2.2 This is not an issue using 2018.3.x **

Unity Editor Screenshot

When options are given for 'sign in' and 'sign out' utter the phrase 'code flow' to initiate the OAuth flow

After the flow is initiated navigate a browser on the second device to https://microsoft.com/devicelogin and input the code provided by the HoloLens app UI. Once this has completed the login will complete, if successful and show the top 5 emails from the logged in users' account.

See https://peted.azurewebsites.net/microsoft-graph-auth-on-hololens-device-code-flow/ for further details.

IL2CPP

This demo was orignally developed in both the Unity editor and using the .NET backend. Since Unity are seeking to deprecate the .NET backend in favour of IL2CPP it makes sense to create demos that are tested in this environment. This caused a few issues that I needed to overcome which are exacerbated by the use of third-party libraries. Please see xxx for further details and my experience of working with IL2CPP.