Skip to main content
The StackOne Hub lets end-users authenticate and configure connectors enabled in your StackOne projects.
StackOne Hub - Connector Selection
StackOne Hub - Credential Entry

Choosing a Hub Version

StackOne offers two Hub versions. We recommend New Hub (beta) for new projects.
New Hub (beta)Hub (v1)
Package@stackone/hub@stackone/react-hub / connect.js
ArchitectureNative React componentIframe-based (loads external script)
React SupportYesYes
Non-React SupportNot yetYes (connect.js)
Filtering & SearchYesNo
Error MessagesDetailed with resolution stepsBasic
ThemingFull theming via design systemLimited styling options
PerformanceFast (direct API calls)Average (iframe network hops)
StatusBeta (Recommended)Legacy

Why New Hub (beta)?

New Hub (beta) is a ground-up rebuild with a fundamentally different architecture:
  • Native React Component: New Hub (beta) renders directly in your React tree. Hub (v1) loads an external script (connect.js) that injects an iframe. This means New Hub (beta) shares your app’s React context, supports proper component composition, and eliminates iframe-related overhead.
  • Direct API Communication: New Hub (beta) makes API calls directly from your app. Hub (v1) routes requests through an iframe hosted on StackOne’s domain, adding latency from cross-origin communication and extra network hops.
  • Full Theming Support: New Hub (beta) uses our Malachite design system, giving you complete control over colors, typography, and styling. You can match your app’s design without CSS hacks or iframe styling limitations.
  • Better Event Handling: New Hub (beta) uses native React callbacks. Hub (v1) relies on postMessage to communicate events across the iframe boundary, which can be less reliable and harder to debug.
Use New Hub (beta) for new projects. It’s in beta but production-ready. Hub (v1) remains available for existing implementations.

Quick Start

New Hub (beta) (@stackone/hub) offers filtering, search, detailed error messages, and full theming support.
New Hub (beta) is in beta. APIs may change without notice.
1

Install the package

npm install @stackone/hub
2

Get a session token from your backend

The Hub needs a connect session token to securely communicate with StackOne. This token must be generated server-side to keep your API key secure.
async function retrieveConnectSessionToken() {
  const response = await fetch('/api/stackone/connect-session', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ username: '[email protected]' }),
  });
  const { token } = await response.json();
  return token;
}
See Connect your Backend with StackOne for backend implementation.
3

Add the component

import { StackOneHub } from "@stackone/hub";
import { useEffect, useState } from "react";

function ConnectorPage() {
  const [token, setToken] = useState<string>();

  useEffect(() => {
    retrieveConnectSessionToken().then(setToken);
  }, []);

  if (!token) return <div>Loading...</div>;

  return (
    <StackOneHub
      token={token}
      onSuccess={(account) => {
        console.log('Connected:', account.id, account.provider);
      }}
      onCancel={() => console.log('Cancelled')}
      onClose={() => console.log('Closed')}
    />
  );
}

API Reference

The StackOneHub component accepts these props:
PropTypeDefaultDescription
tokenstringConnect session token from your backend
mode'integration-picker' | 'csv-importer''integration-picker'Hub mode
accountIdstringPre-select a specific account to edit
baseUrlstring'https://api.stackone.com'StackOne API base URL
appUrlstring'https://app.stackone.com'StackOne App URL
heightstring'500px'Component height
theme'light' | 'dark' | PartialMalachiteTheme'light'Theme configuration
showFooterLinksbooleantrueShow footer links
onSuccess(account: { id: string; provider: string }) => voidCalled when account is connected
onCancel() => voidCalled when user cancels
onClose() => voidCalled when hub closes
import { StackOneHub } from "@stackone/hub";

<StackOneHub
  token={sessionToken}
  mode="integration-picker"
  height="600px"
  theme="dark"
  showFooterLinks={false}
  onSuccess={(account) => {
    console.log(`Connected ${account.provider} with ID ${account.id}`);
  }}
  onCancel={() => console.log('User cancelled')}
  onClose={() => console.log('Hub closed')}
/>

Style Customization

New Hub (beta) supports full theming with the theme prop:
<StackOneHub
  token={token}
  theme="dark"  // or "light"
/>
For custom theming, pass a PartialMalachiteTheme object:
<StackOneHub
  token={token}
  theme={{
    colors: {
      primary: {
        background: '#6366f1',
        foreground: '#ffffff',
      },
      card: {
        background: '#fafafa',
      },
    },
  }}
/>
See the @stackone/hub repository for full theme options.

Hub Behavior Customization

Control which connectors appear in the Hub by configuring the connect session on your backend.

Filtering Connectors

You can specify a provider or categories property when creating the connect session to control which connectors appear in the Hub:
  • provider: Opens the Hub directly at the credential entry screen for a specific connector, bypassing the connector listing
  • categories: Filters the Hub to show only connectors from specified categories (e.g., hris, ats)
If neither is specified, the Hub displays all connectors enabled for the project.
The connector specified in provider must be enabled in the Auth Configs page of the associated project.
Find valid provider keys in the Supported Connectors list under the Provider Key column.

Backend Examples

// Skip connector list, go directly to BambooHR
const result = await stackOne.connectSessions.createConnectSession({
  originOwnerId: "customer-123",
  originOwnerName: "Acme Inc",
  provider: "bamboohr",  // Go directly to this connector
});

Event Callbacks

All Hub versions support these callbacks:
CallbackWhen it fires
onSuccessUser successfully connects an account. Receives account object with id and provider.
onCancelUser explicitly cancels the flow (clicks cancel/back).
onCloseHub closes for any reason (success, cancel, or clicking outside modal).
Use onSuccess to update your UI or trigger backend syncs. Use onClose as a cleanup handler that always runs.
startConnect({
  sessionToken: token,
  onSuccess: (account) => {
    // Refresh your linked accounts
    fetchLinkedAccounts();
    showNotification(`Connected to ${account.provider}`);
  },
  onCancel: () => {
    // User backed out - maybe show a prompt
    console.log('Connection cancelled');
  },
  onClose: () => {
    // Always runs - cleanup
    setIsConnecting(false);
  },
});

Dashboard Access

You can also use the Hub directly from the StackOne dashboard without embedding: Generate connection links from your dashboard to share with end-users.

Direct Account Linking

Link accounts directly from the dashboard interface.

Backend Setup

Both hub versions require a connect session token generated from your backend. This keeps your API key secure.