Search code examples
c#uwpoauth-2.0

UWP OAuth2 using System Browser - Tab Doesn't Close


I'm using a UWP app to authenticate against the Bugine.net Destiny 2 API OAuth2 endpoint. Based on Bungie's security requirements I have to do the authentication using the system browser.

I do this like so:

_ = Launcher.LaunchUriAsync(authUri);

And I have a app protocol registered to receive the response via an OnActivated override.

All this works great and I receive an authentication code, except once I authenticate the browser tab doesn't close.

Is there anything I need to do to ensure that the browser tab will close after the user authenticates?


Solution

  • From the UWP side, I think you don't have any ways to close the System Browser. UWP apps are running in the sandbox and it is isolated, so UWP apps can't control the behavior of other apps like the System Browser. Maybe you could show a guide in your UWP app telling users to close the System Browser manually.