Skip to content

Reference

Connect SDK

Browser widget for embedding OAuth connection flows.

@alter-ai/connect is a browser package that opens an Alter-hosted Connect UI and reports OAuth grants through typed callbacks. It includes Zod as a runtime dependency so cross-window results are validated before application callbacks receive them. It is the frontend half of the Call APIs on behalf of users flow.

Terminal window
npm install @alter-ai/connect

The package metadata declares Node.js 20.19 or later for npm tooling. The CDN browser bundle does not require Node.js.

Or via CDN:

<script src="https://cdn.jsdelivr.net/npm/@alter-ai/connect@latest/dist/alter-connect.umd.js"></script>

Framework-agnostic. Works with React, Vue, Angular, Svelte, or no framework.

The CDN bundle exposes AlterConnect as a global. ES modules use the npm package’s default export plus the named type exports listed in Types. CommonJS consumers access the class as require("@alter-ai/connect").default.

For an end-to-end walk-through, see Embed the Connect widget. This section is API reference.

FlowUse it when
Browser Connect packageA browser application wants the Alter-hosted provider picker, consent UI, branding, and desktop popup callbacks.
createConnectSession() plus pollConnectSession()The application backend needs to own result recovery, including flows where popup callbacks are unavailable.
connect() in the TypeScript or Python SDKA local interactive process can launch a browser, or print a URL for the user, and block while the SDK polls for completion.

The server-side methods live in the TypeScript SDK and Python SDK. They are also the source of recovery-specific exceptions; the browser package returns AlterError objects instead of exporting the server SDK exception classes.

The distributed CJS, ESM, and UMD bundles target ES2020 and use modern browser APIs including popup or full-page navigation, postMessage, URL parsing, and sessionStorage. Importing the package is side-effect free, but AlterConnect.create() must run in a browser context. The repository’s product E2E coverage exercises Chromium; it does not establish a cross-browser version matrix.

Report an issue with this page

Necessary

Required for sign-in, security, authorization, and remembering your choices.

Always active

Analytics

Helps us understand which product and documentation features are useful.

Performance diagnostics

Uses performance tracing and privacy-masked session replay to diagnose problems.

You can change these choices at any time from Cookie settings.