Skip to content

Commit 9291cec

Browse files
lucasloispcodex
andcommitted
Clean up Windows OAuth timeout
Committed-By-Agent: codex Co-authored-by: codex <noreply@openai.com>
1 parent 7bcc36e commit 9291cec

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

SDK/Runtime/EmbeddedWallet/WindowsWebViewHandler.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,18 +71,25 @@ internal async static Task<OAuthResultData> RunOAuthFlow(string url, string redi
7171
var cancellation = Task.Delay(timeout);
7272

7373
var completedTask = await Task.WhenAny(tcs.Task, cancellation);
74+
var timedOut = completedTask == cancellation;
7475

7576
// Only clear the shared reference if it still points at our tcs.
7677
lock (_oauthLock)
7778
{
7879
if (_oauthTcs == tcs)
7980
{
8081
_oauthTcs = null;
82+
if (timedOut)
83+
{
84+
_oauthRedirectUri = null;
85+
}
8186
}
8287
}
8388

84-
if (completedTask == cancellation)
89+
if (timedOut)
8590
{
91+
PrivyWebView_OAuth_HideWindow();
92+
PrivyWebView_OAuth_SetRedirectUrl(null);
8693
tcs.TrySetException(new TimeoutException("OAuth flow timed out."));
8794
}
8895

0 commit comments

Comments
 (0)