Skip to content

Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.

fix: Open Google OAuth in system browser with deep link callback instead of navigating Electron window

Gabriel Steincb154c6a0a8f
diff --git a/.github/workflows/build-and-notarize.yml b/.github/workflows/build-and-notarize.yml
index 720d6486d..1605b7ede 100644
--- a/.github/workflows/build-and-notarize.yml
+++ b/.github/workflows/build-and-notarize.yml
@@ -44,6 +44,7 @@ jobs:
env:
VITE_NEON_AUTH_URL: ${{ vars.VITE_NEON_AUTH_URL }}
VITE_OPENWHISPR_API_URL: ${{ vars.VITE_OPENWHISPR_API_URL }}
+ VITE_OPENWHISPR_OAUTH_CALLBACK_URL: ${{ vars.VITE_OPENWHISPR_OAUTH_CALLBACK_URL }}
- name: Upload Artifacts
uses: actions/upload-artifact@v4
@@ -89,6 +90,7 @@ jobs:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
VITE_NEON_AUTH_URL: ${{ vars.VITE_NEON_AUTH_URL }}
VITE_OPENWHISPR_API_URL: ${{ vars.VITE_OPENWHISPR_API_URL }}
+ VITE_OPENWHISPR_OAUTH_CALLBACK_URL: ${{ vars.VITE_OPENWHISPR_OAUTH_CALLBACK_URL }}
- name: Upload Artifacts
uses: actions/upload-artifact@v4
@@ -158,6 +160,7 @@ jobs:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
VITE_NEON_AUTH_URL: ${{ vars.VITE_NEON_AUTH_URL }}
VITE_OPENWHISPR_API_URL: ${{ vars.VITE_OPENWHISPR_API_URL }}
+ VITE_OPENWHISPR_OAUTH_CALLBACK_URL: ${{ vars.VITE_OPENWHISPR_OAUTH_CALLBACK_URL }}
CSC_IDENTITY_AUTO_DISCOVERY: ${{ github.event_name != 'pull_request' && 'true' || 'false' }}
CSC_KEY_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index c786e26d2..cc626f558 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -52,6 +52,7 @@ jobs:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
VITE_NEON_AUTH_URL: ${{ vars.VITE_NEON_AUTH_URL }}
VITE_OPENWHISPR_API_URL: ${{ vars.VITE_OPENWHISPR_API_URL }}
+ VITE_OPENWHISPR_OAUTH_CALLBACK_URL: ${{ vars.VITE_OPENWHISPR_OAUTH_CALLBACK_URL }}
build-windows:
runs-on: windows-latest
@@ -90,6 +91,7 @@ jobs:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
VITE_NEON_AUTH_URL: ${{ vars.VITE_NEON_AUTH_URL }}
VITE_OPENWHISPR_API_URL: ${{ vars.VITE_OPENWHISPR_API_URL }}
+ VITE_OPENWHISPR_OAUTH_CALLBACK_URL: ${{ vars.VITE_OPENWHISPR_OAUTH_CALLBACK_URL }}
build-macos:
runs-on: macos-latest
@@ -151,6 +153,7 @@ jobs:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
VITE_NEON_AUTH_URL: ${{ vars.VITE_NEON_AUTH_URL }}
VITE_OPENWHISPR_API_URL: ${{ vars.VITE_OPENWHISPR_API_URL }}
+ VITE_OPENWHISPR_OAUTH_CALLBACK_URL: ${{ vars.VITE_OPENWHISPR_OAUTH_CALLBACK_URL }}
CSC_IDENTITY_AUTO_DISCOVERY: true
CSC_KEY_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
diff --git a/main.js b/main.js
index 5b27e478e..be6272e6c 100644
--- a/main.js
+++ b/main.js
@@ -284,19 +284,24 @@ function navigateControlPanelWithVerifier(verifier) {
if (!isLiveWindow(windowManager?.controlPanelWindow)) return;
const appUrl = DevServerManager.getAppUrl(true);
- if (!appUrl) return;
- const separator = appUrl.includes('?') ? '&' : '?';
- const urlWithVerifier = `${appUrl}${separator}neon_auth_session_verifier=${encodeURIComponent(verifier)}`;
+ if (appUrl) {
+ const separator = appUrl.includes('?') ? '&' : '?';
+ const urlWithVerifier = `${appUrl}${separator}neon_auth_session_verifier=${encodeURIComponent(verifier)}`;
+ windowManager.controlPanelWindow.loadURL(urlWithVerifier);
+ } else {
+ const fileInfo = DevServerManager.getAppFilePath(true);
+ if (!fileInfo) return;
+ fileInfo.query.neon_auth_session_verifier = verifier;
+ windowManager.controlPanelWindow.loadFile(fileInfo.path, { query: fileInfo.query });
+ }
+
if (debugLogger) {
debugLogger.debug("Navigating control panel with OAuth verifier", {
appChannel: APP_CHANNEL,
oauthProtocol: OAUTH_PROTOCOL,
- devServerUrl: appUrl,
- authBridgeUrl: `http://${AUTH_BRIDGE_HOST}:${AUTH_BRIDGE_PORT}${AUTH_BRIDGE_PATH}`,
});
}
- windowManager.controlPanelWindow.loadURL(urlWithVerifier);
windowManager.controlPanelWindow.show();
windowManager.controlPanelWindow.focus();
}
diff --git a/src/components/AuthenticationStep.tsx b/src/components/AuthenticationStep.tsx
index b4cf0745e..6eeae68e0 100644
--- a/src/components/AuthenticationStep.tsx
+++ b/src/components/AuthenticationStep.tsx
@@ -516,11 +516,18 @@ export default function AuthenticationStep({
className="w-full h-9"
>
{isSocialLoading === "google" ? (
- <Loader2 className="w-4 h-4 animate-spin text-muted-foreground" />
+ <>
+ <Loader2 className="w-4 h-4 animate-spin text-muted-foreground" />
+ <span className="text-sm font-medium text-muted-foreground">
+ Complete sign-in in your browser...
+ </span>
+ </>
) : (
- <GoogleIcon className="w-4 h-4" />
+ <>
+ <GoogleIcon className="w-4 h-4" />
+ <span className="text-sm font-medium">Continue with Google</span>
+ </>
)}
- <span className="text-sm font-medium">Continue with Google</span>
</Button>
{/* Divider — Minimal */}
diff --git a/src/components/ControlPanel.tsx b/src/components/ControlPanel.tsx
index 4996d08d4..687cfcfc9 100644
--- a/src/components/ControlPanel.tsx
+++ b/src/components/ControlPanel.tsx
@@ -403,7 +403,9 @@ export default function ControlPanel() {
Welcome to OpenWhispr Pro
</p>
<p className="text-[12px] text-muted-foreground mb-2">
- Your 7-day free trial is active! We've switched your transcription to OpenWhispr Cloud for faster, more accurate results. Your previous settings are saved — switch back anytime in Settings.
+ Your 7-day free trial is active! We've switched your transcription to OpenWhispr
+ Cloud for faster, more accurate results. Your previous settings are saved —
+ switch back anytime in Settings.
</p>
<Button
variant="default"
diff --git a/src/components/SettingsPage.tsx b/src/components/SettingsPage.tsx
index 6a51fcc33..ea711bfec 100644
--- a/src/components/SettingsPage.tsx
+++ b/src/components/SettingsPage.tsx
@@ -417,10 +417,7 @@ function AiModelsSection({
<SettingsPanel>
<SettingsPanelRow>
<SettingsRow label="Enable text cleanup" description="AI improves transcription quality">
- <Toggle
- checked={useReasoningModel}
- onChange={setUseReasoningModel}
- />
+ <Toggle checked={useReasoningModel} onChange={setUseReasoningModel} />
</SettingsRow>
</SettingsPanelRow>
</SettingsPanel>
@@ -460,7 +457,9 @@ function AiModelsSection({
</div>
<div className="flex-1 min-w-0">
<div className="flex items-center gap-2">
- <span className="text-[12px] font-medium text-foreground">OpenWhispr Cloud</span>
+ <span className="text-[12px] font-medium text-foreground">
+ OpenWhispr Cloud
+ </span>
{isCloudMode && (
<span className="text-[10px] font-medium text-primary bg-primary/10 dark:bg-primary/15 px-1.5 py-px rounded-sm">
Active
diff --git a/src/helpers/audioManager.js b/src/helpers/audioManager.js
index f93220814..621e7bcf6 100644
--- a/src/helpers/audioManager.js
+++ b/src/helpers/audioManager.js
@@ -1060,7 +1060,11 @@ class AudioManager {
} else {
const reasoningModel = localStorage.getItem("reasoningModel") || "";
if (reasoningModel) {
- const result = await this.processWithReasoningModel(processedText, reasoningModel, agentName);
+ const result = await this.processWithReasoningModel(
+ processedText,
+ reasoningModel,
+ agentName
+ );
if (result) {
processedText = result;
}
@@ -1974,7 +1978,11 @@ class AudioManager {
} else {
const reasoningModel = localStorage.getItem("reasoningModel") || "";
if (reasoningModel) {
- const result = await this.processWithReasoningModel(finalText, reasoningModel, agentName);
+ const result = await this.processWithReasoningModel(
+ finalText,
+ reasoningModel,
+ agentName
+ );
if (result) {
finalText = result;
}
diff --git a/src/hooks/useSettings.ts b/src/hooks/useSettings.ts
index f68f0370d..58ab971cc 100644
--- a/src/hooks/useSettings.ts
+++ b/src/hooks/useSettings.ts
@@ -581,7 +581,13 @@ export function useSettings() {
if (settings.cloudReasoningMode !== undefined)
setCloudReasoningMode(settings.cloudReasoningMode);
},
- [setUseReasoningModel, setReasoningModel, setReasoningProvider, setCloudReasoningBaseUrl, setCloudReasoningMode]
+ [
+ setUseReasoningModel,
+ setReasoningModel,
+ setReasoningProvider,
+ setCloudReasoningBaseUrl,
+ setCloudReasoningMode,
+ ]
);
const updateApiKeys = useCallback(
diff --git a/src/lib/neonAuth.ts b/src/lib/neonAuth.ts
index 1290412ec..a261be517 100644
--- a/src/lib/neonAuth.ts
+++ b/src/lib/neonAuth.ts
@@ -1,6 +1,7 @@
import { createAuthClient } from "@neondatabase/auth";
import { BetterAuthReactAdapter } from "@neondatabase/auth/react";
import { OPENWHISPR_API_URL } from "../config/constants";
+import { openExternalLink } from "../utils/externalLinks";
export const NEON_AUTH_URL = import.meta.env.VITE_NEON_AUTH_URL || "";
export const authClient = NEON_AUTH_URL
@@ -195,24 +196,43 @@ export async function withSessionRefresh<T>(operation: () => Promise<T>): Promis
}
}
+function getElectronOAuthCallbackURL(): string {
+ const configuredUrl = (import.meta.env.VITE_OPENWHISPR_OAUTH_CALLBACK_URL || "").trim();
+ if (configuredUrl) return configuredUrl;
+
+ if (window.location.protocol !== "file:") return `${window.location.origin}/?panel=true`;
+
+ const port = import.meta.env.VITE_DEV_SERVER_PORT || "5183";
+ return `http://localhost:${port}/?panel=true`;
+}
+
export async function signInWithSocial(provider: SocialProvider): Promise<{ error?: Error }> {
if (!authClient) {
return { error: new Error("Auth not configured") };
}
try {
- // Electron's file:// origin is rejected by Neon Auth — use a relative path instead
const isElectron = Boolean((window as any).electronAPI);
- const callbackURL = isElectron
- ? "/?panel=true"
- : `${window.location.href.split("?")[0].split("#")[0]}?panel=true`;
-
- await authClient.signIn.social({
- provider,
- callbackURL,
- newUserCallbackURL: callbackURL,
- });
+ if (isElectron) {
+ const callbackURL = getElectronOAuthCallbackURL();
+
+ const response = await fetch(`${NEON_AUTH_URL}/api/auth/sign-in/social`, {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ credentials: "include",
+ body: JSON.stringify({ provider, callbackURL, disableRedirect: true }),
+ });
+
+ const data = await response.json();
+ if (!data.url) return { error: new Error("Failed to get OAuth URL") };
+
+ openExternalLink(data.url);
+ return {};
+ }
+
+ const callbackURL = `${window.location.href.split("?")[0].split("#")[0]}?panel=true`;
+ await authClient.signIn.social({ provider, callbackURL, newUserCallbackURL: callbackURL });
return {};
} catch (error) {
return { error: error instanceof Error ? error : new Error("Social sign-in failed") };