mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Fix race condition in login
This commit is contained in:
@ -110,12 +110,12 @@ namespace Wabbajack
|
|||||||
private async Task OAuthLogin(RequestOAuthLogin oa, WebBrowserVM vm, CancellationTokenSource cancel)
|
private async Task OAuthLogin(RequestOAuthLogin oa, WebBrowserVM vm, CancellationTokenSource cancel)
|
||||||
{
|
{
|
||||||
await vm.Driver.WaitForInitialized();
|
await vm.Driver.WaitForInitialized();
|
||||||
vm.Instructions = "Please log in and allow Wabbajack to access your account";
|
vm.Instructions = $"Please log in and allow Wabbajack to access your {oa.SiteName} account";
|
||||||
|
|
||||||
var wrapper = new CefSharpWrapper(vm.Browser);
|
var wrapper = new CefSharpWrapper(vm.Browser);
|
||||||
var scopes = string.Join(" ", oa.Scopes);
|
var scopes = string.Join(" ", oa.Scopes);
|
||||||
var state = Guid.NewGuid().ToString();
|
var state = Guid.NewGuid().ToString();
|
||||||
await wrapper.NavigateTo(new Uri(oa.AuthorizationEndpoint + $"?response_type=code&client_id={oa.ClientID}&state={state}&scope={scopes}"));
|
|
||||||
|
|
||||||
Helpers.SchemeHandler = (browser, frame, _, request) =>
|
Helpers.SchemeHandler = (browser, frame, _, request) =>
|
||||||
{
|
{
|
||||||
@ -140,6 +140,8 @@ namespace Wabbajack
|
|||||||
}
|
}
|
||||||
return new ResourceHandler();
|
return new ResourceHandler();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
await wrapper.NavigateTo(new Uri(oa.AuthorizationEndpoint + $"?response_type=code&client_id={oa.ClientID}&state={state}&scope={scopes}"));
|
||||||
|
|
||||||
while (!oa.Task.IsCanceled && !oa.Task.IsCompleted && !cancel.IsCancellationRequested)
|
while (!oa.Task.IsCanceled && !oa.Task.IsCompleted && !cancel.IsCancellationRequested)
|
||||||
await Task.Delay(250);
|
await Task.Delay(250);
|
||||||
|
Reference in New Issue
Block a user