#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere
TypeScript dockerhacktoberfestjavapdfpdf-converterpdf-editorpdf-manipulationpdf-mergerpdf-ocrpdf-toolspdf-web-appspdfmergerself-hosted
import { authService } from "@editor/services/authService";
import { connectionModeService } from "@editor/services/connectionModeService";
/**
* Desktop-specific OAuth navigation: prefer popup/system browser, avoid hijacking main webview.
*/
export async function startOAuthNavigation(
redirectUrl: string,
): Promise<boolean> {
try {
const currentConfig = await connectionModeService
.getCurrentConfig()
.catch(() => null);
const serverUrl = currentConfig?.server_config?.url;
if (!serverUrl) {
return false;
}
const providerUrl = new URL(redirectUrl, serverUrl);
const providerPath = `${providerUrl.pathname}${providerUrl.search}`;
await authService.loginWithSelfHostedOAuth(providerPath, serverUrl);
return true;
} catch (error) {
console.warn("[Desktop OAuthNavigation] Failed to start OAuth flow", error);
return false;
}
}