Closed spalmcc closed 7 months ago
We generally use UserCancel
when the browser is closed before the async operation is completed, see: https://github.com/search?q=repo%3Aauth0%2Fauth0-oidc-client-net%20UserCancel&type=code
We generally use
UserCancel
when the browser is closed before the async operation is completed, see: https://github.com/search?q=repo%3Aauth0%2Fauth0-oidc-client-net%20UserCancel&type=code
Hi, Browser is closed? I have a desktop application (windows forms). I was trying to log out. What you have mentioned is not clear to me.
BrowserResultType browserResult; if (client != null) { browserResult = await client.LogoutAsync(); // browserResult = BrowserResultType.UserCancel (This is what I am getting) }
Yes, we use webview and open the browser to handle login and logout.
For WinForms using WebViewBrowser, see:
However, could it be that you are using WebBrowserBrowser
?
Can you provide a reproduction so i can look into this ?
Yes, we use webview and open the browser to handle login and logout.
Can you provide a reproduction so i can look into this ?
I am using webview. The following is the code for logging out:-
BrowserResultType browserResult; if (client != null) { browserResult = await client.LogoutAsync();
}
When I checked the value in "browserResult" I see "BrowserResultType.UserCancel " which is not correct. It should be "BrowserResultType.Success".
So I am trying to understand what exactly is meant by "BrowserResultType.UserCancel " and what can cause this?
I updated my comment above to link to the implementation: https://github.com/auth0/auth0-oidc-client-net/blob/master/src/Auth0.OidcClient.WinForms/WebViewBrowser.cs#L62-L66
As you can seem we use UserCancel in the following case:
window.Closing += (sender, e) =>
{
if (!tcs.Task.IsCompleted)
tcs.SetResult(new BrowserResult { ResultType = BrowserResultType.UserCancel });
};
So as you can see, and as I said, we set UserCancel when the browser is closed before the async operation is completed. If UserCancel is unexpected, I will need to have a reproduction to understand what's going on.
Seems I have found the issue. I missed adding "WebViewBrowser.cs" and "WebViewBrowserChromium.cs" classes. I am chekcing the same now.
I understand the issue now. My form was closed and after that I was trying to log off thats why I was getting that issue.
thanks alot for the clarificaiton and support.
Checklist
Description
Trying to find "BrowserResultType.UserCancel" indicates?
Reproduction
Just need information
Additional context
Having some issues with integrating Auth0. Need to know what "BrowserResultType.UserCancel"indicates?
auth0-oidc-client-net version
3.5.0
.NET version
.NET6
Platform
Windows
Platform version(s)
.NET6