/** * Login-window handling for OAuth-authenticated MCP servers. * @module @anht3889/dsh-mcp-mgmt-bundle/client/oauth-login */ /** * Message channel the login window uses to report its outcome. The writing half * is the manager's completion page (`@anht3889/dsh-mcp-mgmt-bundle/manager`); a * client bundle cannot import that package, so both sides spell the literal. */ export declare const OAUTH_MESSAGE_SOURCE = "dsh-mcp-management/oauth"; /** Outcome the login window reports for one authorization-code exchange. */ export type OAuthCompletion = { ok: true; serverId: string; } | { ok: false; error: string; }; /** What the section shows while one server's authorization is in flight. */ export type OAuthLoginState = /** Requesting the provider's authorization URL. */ { phase: 'starting'; } /** The login window is open and the operator is signing in. */ | { phase: 'waiting'; } /** The browser refused the login window; the operator opens the URL instead. */ | { phase: 'blocked'; authorizeUrl: string; } /** The exchange or the request for an authorization URL failed. */ | { phase: 'failed'; error: string; }; /** * Open the login window while the click that asked for it is still being * handled. * * Browsers only honor `window.open` during a user gesture, so the window opens * blank up front and moves to the provider once the authorization URL arrives. * It deliberately keeps its opener, which is how the completion page notifies * this section. * * @returns the opened window, or `undefined` when the browser blocked it. */ export declare function openLoginWindow(): Window | undefined; /** * Send an opened login window to the provider's authorization URL. * @param loginWindow - the window from {@link openLoginWindow}. * @param authorizeUrl - the provider URL to load. * @returns true when the window accepted the navigation. */ export declare function navigateLoginWindow(loginWindow: Window | undefined, authorizeUrl: string): boolean; /** * Read a completion posted by the login window. * @param event - a `message` event from any origin. * @returns the reported outcome, or `undefined` for unrelated messages. */ export declare function readOAuthCompletion(event: MessageEvent): OAuthCompletion | undefined; //# sourceMappingURL=oauth-login.d.ts.map