fix(auth): open OAuth popup before async PKCE

Browsers block window.open after an await because the user
gesture is lost. Open a blank tab synchronously first, then
set the URL after PKCE generation completes.
This commit is contained in:
Nicholai Vogel 2026-02-16 23:45:26 -07:00
parent c53f3a5fac
commit 7d7eb72ea8

View File

@ -317,10 +317,13 @@ function ProviderConfigSection({
}
const handleOAuthConnect = async (): Promise<void> => {
// Open window immediately in the click handler to avoid
// popup blockers (async gap kills the user gesture)
const popup = window.open("about:blank", "_blank", "noopener")
const { verifier, challenge } = await generatePKCE()
const url = buildAuthUrl(challenge)
if (popup) popup.location.href = url
setOAuth({ step: "connecting", verifier })
window.open(url, "_blank", "noopener")
}
const handleOAuthSubmit = async (): Promise<void> => {