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
- “Remove Unused Overrides” available on not loaded Scene and throws “ArgumentException: The scene is not loaded” warning
- Adaptive Probe Volume occlusion edge is calculated incorrectly when viewing probes near geometry edges
- Sampling a texture using an HLSL file throws shader errors and the code does not compile
- "Graphics.CopyTexture called with null source texture" error when Base Camera of an Overlay Camera is removed with DX11 Graphics API and Compatibility Mode enabled
- WebGL sends wrong value with large numbers when SendMessage function is used
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);
});