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
- Out-of-bounds memory access with multiple CanvasRenderers under a Canvas when using Mesh API
- Inspector tries to access file after it was deleted when the file was locked in Inspector window
- Changing Transform values in Search window Inspector loses focus while dragging and stopping mouse without releasing dragging action
- Saving changes on the dirty VFX Graph during the Play mode throws "The referenced script (Unknown) on this Behaviour is missing!" warnings
- VFX Graph Debug Info overlaps the "Initialize" block debug info by default
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);
});