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
- Assets are created in the Package folders when creating assets via custom buttons in the Inspector window or other windows
- “Select” windows are named differently on Windows and macOS
- [Windows] No minimum “Select” window size
- Enabling “Editor Extension Authoring” in UI Builder doesn’t dirty the document and saving with shortcut doesn’t persist the state
- WebRequest.Create() function fails with "URI prefix is not recognized" errors when the project is built for Linux Standalone or Windows Dedicated Server
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);
});