dotMorten / WinUIEx

WinUI Extensions
https://dotmorten.github.io/WinUIEx
MIT License
572 stars 36 forks source link

WebAuthenticator Opens Second Instance of App (MAUI) #111

Closed zizusoft closed 1 year ago

zizusoft commented 1 year ago

In lieu of the MAUI WebAuthenticator issue (https://github.com/dotnet/maui/issues/2702)

I am trying to use this for my MAUI project with Windows.

image

It launches the web browser for authentication just fine - the only issue is that once I complete authentication, the web browser prompts me to relaunch my app - and creates a second instance of the App rather than returning to the original one that opened the browser.

image

image

Have I missed something in the setup?

Thanks

dotMorten commented 1 year ago

App activation works by starting a new instance. WinUiEx should detect it’s meant for an existing instance and redirect the activation to that app and shut the new instance down. If that doesn’t happen it’s likely your oauth service is munging the state parameter that contains the information about your existing instance that the activation is meant for

zizusoft commented 1 year ago

Thanks for getting back to me so quickly.

I'm using Microsoft Azure's OAUTH 2 SSO....

I thought it best to try with your sample / example for MAUI just to prove it is an issue with Microsoft, and not WinUIEx / my setup.

Have the credentials changed from your sample, as If I used the supplied email and password, I get red outlines on the sign in box which I assume means the password is wrong?

image

Thanks

zizusoft commented 1 year ago

Hi @dotMorten,

I've just noticed that this looks like the same issue as #96 ?

droll2571 commented 1 year ago

@zizusoft,

I was experiencing the same issue in my dotnet MAUI application until I set the window's persistence ID.

image

dotMorten commented 1 year ago

That’s really odd. The persistence has nothing to do with auth