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
- Texture2D hash changes inside of an AssetBundle when rebuilding a SpriteAtlas bundle with an empty AssetPostprocessor Script enabled
- Aniso Level still applies when Generate MipMap is disabled in Texture Import Settings
- Mipmap Limit Groups long names are not truncated when creating a new Mipmap Limit Group with a long name
- “ArgumentException: Invalid double parameter.” error is thrown when Infinity is typed into the Fixed Timestep field
- GameObject becomes gray when using HDRP and STP together on macOS
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);
});