Search Issue Tracker
Won't Fix
Votes
0
Found in
2019.4
2019.4.28f1
2020.3
2021.1
Issue ID
1359358
Regression
No
[UWP] C# WebAuthenticationBroker doesn't work when built into HoloLens 2
1. Open project "MRTKWebAuthProject.zip"
2. Open Scene "ReproScene"
3. Open Build Settings in File > Build Settings
4. Select Platform "Universal Windows Platform" and build project
5. Open solution of built project
6. Change solution configuration from "Debug" to "Release" and set solution platform to ARM64
7. Open the Holographic Remoting Player app on the HoloLens 2
8. Copy the IP Address
9. Open Properties in Project > Properties
10. Select Debugging under Configuration Properties
11. Type the IP address in Machine Name
12. Build on Remote Machine
13. Press the button "Click Here" in the app
Expected result: Window should appear asking login details
Actual result: Window doesn't appear asking login details
Reproducible with: 2019.4.31f1, 2020.3.19f1, 2021.1.22f1
Could not test with: 2021.2.0b12, 2022.1.0a10 (Mixed Reality Toolkit package errors)
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- "Shader warning in 'Hidden/Light2D': implicit truncation of vector type" is thrown when building Universal 2D template
- AI Assistant breaks compilation of packages using System.Runtime.CompilerServices.Unsafe via auto-referencing
- Unity Hub checks the "Documentation" module by default on the 6.4 and 6.5 streams despite that it was unchecked with the previous installs
- Shortcut that toggles between Dopesheet and Curves Views in the Animation Window's Timeline is mislabed
- Property List Items Overlap onto the Property List's top edge when scrolling through a long Property List
Resolution Note:
The documentation of WebAuthenticationBroker says it must be used from UI thread: https://docs.microsoft.com/en-us/uwp/api/windows.security.authentication.web.webauthenticationbroker.authenticateasync?view=winrt-20348#Windows_Security_Authentication_Web_WebAuthenticationBroker_AuthenticateAsync_Windows_Security_Authentication_Web_WebAuthenticationOptions_Windows_Foundation_Uri_Windows_Foundation_Uri_ ("This method must be called on the UI thread.")
The attached project calls it from non-UI thread. Wrap the call in UI thread call and it should work:
UnityEngine.WSA.Application.InvokeOnUIThread(async () =>
{
string url = "<URL>";
var wab = await WebAuthenticationBroker.AuthenticateAsync(WebAuthenticationOptions.None, new Uri(url), new Uri("http://127.0.0.1"));
var message = wab.ResponseData;
Debug.Log(message);
});