Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Universal Login closes on error when using WinForms with WebBrowserBrowser #79

Closed
natelaff opened this issue Jun 26, 2019 · 13 comments · Fixed by #132
Closed

Universal Login closes on error when using WinForms with WebBrowserBrowser #79

natelaff opened this issue Jun 26, 2019 · 13 comments · Fixed by #132

Comments

@natelaff
Copy link

My guess is this isn't an issue with this client specifically, but the implementation of the new universal login, but just going to file here.

When using the New Universal Login, if in the winforms client you type in the wrong username/password, the browser just closes and gives you an Http error. In the old flow, the browser would remain open during failed attempts.

@damieng
Copy link
Contributor

damieng commented Oct 19, 2019

Not able to reproduce this (screenshot attached). If it is still a problem please respond here so I can reopen the issue.

image

@damieng damieng closed this as completed Oct 19, 2019
@natelaff
Copy link
Author

You're not using the New Universal Login, that's the Classic login.

@damieng
Copy link
Contributor

damieng commented Nov 16, 2019

It was actually the New Universal Login with a custom theme but I just retested the WinForms in 3.1.0 with the default ULP theme and still can't reproduce.

image

Have you tried it with 3.x or above? It now uses a totally different control on Windows that is Edge based not Internet Explorer based.

@natelaff
Copy link
Author

Ah, 3.x seems to fix it. I was on 2.4.0

@damieng
Copy link
Contributor

damieng commented Nov 16, 2019

Yeah 2.x used Internet Explorer - nothing really worked that well with it any more :( Even the GitHub.com sign-in page despite being owned by Microsoft took up about a third of the screen with a giant "Internet Explorer not supported" banner.

Feel free to respond here or raise a new issue if you have any problems with 3.x

@natelaff
Copy link
Author

natelaff commented Nov 27, 2019

Actually I can reproduce this now. If you implement your own IBrowser the window will close with a 400 response.

Even if I use the exact code from https://github.com/auth0/auth0-oidc-client-net/blob/master/src/Auth0.OidcClient.WinForms/WebBrowserBrowser.cs

It will still do it.

Any idea on why that might be?

I will fork and reproduce if needed.

@damieng damieng reopened this Nov 27, 2019
@natelaff
Copy link
Author

natelaff commented Nov 27, 2019

Oh, wait. I see you what you did. You have that one and WebViewBrowser which is the new one. I plopped that in and everything is good again.

That's not going to be Win7 compatible though is it? EDIT: Nope, that's Win10 only.

So, need to figure out why WebBrowserBrowser does this :P

@natelaff
Copy link
Author

Seems like you can "fix" this with the following:

            browser.NavigateError += (s, e) =>
            {
                if (e.StatusCode != 400)
                {
                    e.Cancel = true;
                    result.ResultType = BrowserResultType.HttpError;
                    result.Error = e.StatusCode.ToString();
                    signal.Release();
                }
            };

Just ignoring a 400 Bad Request status code. I suppose this could mess up other things, but this does resolve the issue as far as I can tell.

@damieng
Copy link
Contributor

damieng commented Nov 28, 2019

The WebViewBrowser uses WebViewCompatible from the Windows Toolkit open source project.

From their description:

Provides a version of WebView that is compatible with more OS versions. This control uses the Microsoft Edge rendering engine to show web content on Windows 10 version 1803 and later, and the Internet Explorer rendering engine to show web content on earlier versions of Windows 10, Windows 8.x, and Windows 7.

I'll checked out the WebBrowserBrowser issue - nothing in that class should have changed since the previous version where it was the default.

@natelaff
Copy link
Author

Oh, it does work on 7 and 8? I found this and it said it was 10 only...
https://docs.microsoft.com/en-us/windows/communitytoolkit/controls/wpf-winforms/webview

Nothing changed, this was always broken there but "fixed" in the latest version. It wasn't really fixed in the WebBrowserBrowser, you just changed the default implementation of IBrowser so this one wasn't used any longer.

@damieng
Copy link
Contributor

damieng commented Nov 28, 2019

That is the WebView control - we use WebViewCompatible that uses WebView if it can then falls back to IE if it can't.

@natelaff
Copy link
Author

Ok, I'll switch to that thing since its compatible with 7. I suppose you can close (again, and for the last time hopefully 😂). Maybe this will help someone else who hasn't updated and has their own IBrowser implementation.

Thanks for your help and patience ;)

@damieng
Copy link
Contributor

damieng commented Nov 28, 2019

No problem. I've been able to reproduce the closing-window on failed password with the older WebBrowserBrowser issue so that needs to be fixed.

@damieng damieng changed the title New Universal Login and wrong username/password Universal Login closes on error when using WinForms with WebBrowserBrowser Nov 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants