Docs · Reference · Live demo · Dashboard · Release notes
One Connect is One's embeddable authentication for your product. Add it, and each of your users connects their own Gmail, Slack, Notion, Stripe or any other app on One's hosted page, chooses how much your product can reach, and can take it back at any time. Sign-in, consent, credential storage, refresh and the check on every call all run on One's side.
In your product it is a button and two backend routes. Your server keeps one key for the app and one short id for each user, and it never holds a provider credential.
Connect is free on every plan.
Install the Connect skill in your app's repo, then hand the rest to your coding agent.
npx skills add withoneai/connectThen send your agent this message.
Use the one-connect skill to add One Connect to this app
Your agent installs @withone/connect, describes your app in one.connect.ts and runs one connect create, which opens your browser. You approve the app there, as your users will see it, and copy its two secrets into your env file. They are made on that page and shown once, which keeps them out of the terminal and the chat. Then the agent wires the two routes, the button and the calls. If the One CLI is not on your machine yet, the skill tells your agent how to install it and sign you in.
Already made the app in the dashboard? Its page has the same install command and a prompt with your app's ids under Hand it to your agent.
The skill lives in skills/one-connect and ships inside the package.
npm install @withone/connect1. Create your app. In the dashboard, go to Developers → Connect → New app, register your callback URL and choose what the app asks for. The card your users will see sits beside it and updates as you choose.
Or describe the app in one.connect.ts and run one connect create with the One CLI. Either way you end up with these.
ONE_CLIENT_ID=…
ONE_CLIENT_SECRET=one_secret_… # server only
ONE_CONNECT_KEY=sk_live_… # server only
ONE_REDIRECT_URI=https://yourapp.com/api/one/callback # exactly the registered URL
ONE_PERMISSION_SET=… # optional, what the app asks for2. Create the server client. userId is your app's own id for the user. reference is one short string to save in a column and hand back unchanged.
// lib/one.ts (server only)
import { createOneConnect } from "@withone/connect/server";
export const oneConnect = createOneConnect({
clientId: process.env.ONE_CLIENT_ID!,
clientSecret: process.env.ONE_CLIENT_SECRET!,
redirectUri: process.env.ONE_REDIRECT_URI!,
permissionSet: process.env.ONE_PERMISSION_SET,
connectKey: process.env.ONE_CONNECT_KEY!,
userStore: {
saveUser: (userId, reference) => db.users.update(userId, { oneConnect: reference }),
loadUser: async (userId) => (await db.users.find(userId))?.oneConnect ?? null,
clearUser: (userId) => db.users.update(userId, { oneConnect: null }),
},
});3. Mount the two routes. This file serves /api/one/authorize and /api/one/callback. identifyUser returns the id of your own signed-in user.
// app/api/one/[action]/route.ts (Next.js App Router)
import { createOneConnectRoutes } from "@withone/connect/next";
import { oneConnect } from "@/lib/one";
export const { GET } = createOneConnectRoutes(oneConnect, {
identifyUser: async (request) => (await getSession(request))?.userId ?? null,
signInUrl: "/login",
});Remix, SvelteKit, Hono and Bun pass their own web Request to the same GET. For Express, Fastify, Koa or plain Node, createOneConnectHandlers from @withone/connect/node returns { authorize, callback } to mount on those two paths.
4. Add the button.
import { ConnectButton } from "@withone/connect/react";
<ConnectButton
authorizeUrl="/api/one/authorize"
logos={["gmail", "google-calendar", "stripe"]}
connected={user.hasOneGrant} // from your server: await oneConnect.isConnected(userId)
onSuccess={() => refresh()}
/>5. Call One with the grant.
const connections = await oneConnect.listConnections(userId);
const stripe = connections.find((c) => c.platform === "stripe");
const [action] = await oneConnect.searchActions(userId, "stripe", "list invoice items");
const reply = await oneConnect.runAction(userId, {
connectionKey: stripe.key,
actionId: action._id,
body: { limit: 10 },
});
// { status, ok, blockedByGrant, refusal, rateLimit, data }The docs take each step further. See Create your app, Add it to your product and Use the grant.
Browser Your server One
<ConnectButton> ──────► GET /api/one/authorize ──302──► One's page (sign in, set access)
GET /api/one/callback ◄──302── ?code&state
saves the grant for the user, redirects home
onSuccess() ◄──────
later: oneConnect.runAction(userId, …) ──► One, grant enforced
or, for your own agent: oneConnect.getMcpToken(userId) ──► a bearer for One's MCP server
or the One CLI with your connect key and the user's id
- You choose what to ask for. Name the apps and set read only, read and write, full access or exact actions for each, in the dashboard or in
one.connect.ts. An agent that works across whatever its users have can ask for everything instead. - Your user decides what to give. Every app you asked for shows with its level. They can narrow any of them before they authorize, and never widen one.
- One does the rest. The connections stay in your user's One account. One attaches the credential on its side when an action runs and checks the grant on every call.
The button sends the browser to One's hosted page, in your name and your colours. Your user confirms their email with a six digit code, picks a space if they belong to an organization, then sets the access for each app. A missing app connects right there in the flow.
They can change a level, add another account or turn an app off later from your product or from their One dashboard, and One applies it on the next call. See What your users see and Manage users and access.
ConnectButton comes for React and Vue, as a Svelte action and as the <one-connect-button> web component. It has three variants, three sizes, a light and a dark theme, and it takes your brand colour.
<ConnectButton authorizeUrl="/api/one/authorize" label="Connect your tools" accent="#F4A938" />The flow is a full page redirect to your authorize route, which means any element can start it. Keep your own design system button and wire the flow to it.
import { useOneConnect } from "@withone/connect/react";
const { open, status } = useOneConnect({
authorizeUrl: "/api/one/authorize",
onSuccess: () => refresh(),
});
<button onClick={open} disabled={status === "connecting"}>Connect your tools</button>| You want | Use |
|---|---|
| Your own button in React | useOneConnect from @withone/connect/react |
| Your own button in any framework, or none | createConnectFlow from @withone/connect |
| No SDK in the browser | A plain link to your authorize route |
| One app connected now, from a chat or a settings row | openApp: "gmail", with returnTo for the page to come back to |
| A Manage button for each app the user granted | listConnections, then openApp for each app |
See Add it to your product for every prop and state.
Work the way the One CLI does. Find the action, read its knowledge, run it. getActionKnowledge returns the action's guide with every field it takes, and runAction takes the method and path from the action, fills the path's placeholders and adds One's headers.
One judges every action by what it does to the user's data, never by its HTTP method. A read only grant runs a search that is sent as a POST and refuses a GET that changes something. A call outside the grant never reaches the provider.
refusal |
Status | What happened |
|---|---|---|
"grant" |
403 |
The call is outside what the user granted. Don't retry it |
"plan_limit" |
402 |
Your One plan is at its monthly limit, counted across all your users. It is not the grant |
"rate_limit" |
429 |
Too many calls. Wait rateLimit.retryAfter seconds |
"one_error" |
other | Retry with a backoff |
null |
any | The provider's own answer, or a success |
See Use the grant for the full call shapes, rate limits and errors.
If your product runs its own AI agent, hand it the user's grant and let it find and run actions itself. It reaches exactly what the user granted, at the same levels.
const { accessToken, url } = await oneConnect.getMcpToken(userId);
// url is https://mcp.withone.ai/mcp. Give both to your agent's MCP client,
// Streamable HTTP, with the header Authorization: Bearer <accessToken>| One's MCP server | The One CLI | |
|---|---|---|
| Your agent gets | A bearer for one user, for 15 minutes in key mode | one list and one actions, run as the user |
| Your server sets | Nothing more | ONE_SECRET and ONE_CONNECT_USER_ID for each run |
| Fits | An agent with an MCP client, or one that needs a raw shell | An agent that calls tools as commands |
| Works in | Key mode and token mode | Key mode only |
See Give your agent the MCP server and Give your agent the CLI.
Everything above is key mode, the default. Your server keeps one connect key for the app and one id for each user, nothing expires and nothing is refreshed. In token mode your server stores an access token and a refresh token for each user, as a standard OAuth client, and runs a daily refresh job. The button, the routes and the calls are the same either way.
Pick token mode when your app already stores tokens. Pass a tokenStore in place of connectKey and userStore. See the two modes in the docs.
Each Connect app has a page in the dashboard with who connected, what each person let it reach, and every call it made for them, including the ones One blocked.
- Secrets stay on the server. The client secret and the connect key live in environment variables, never in browser code, logs, error reports or source control.
- A connect key is bound to your app and does nothing without a user's id. Lost or leaked one? Create another on the app's page, move your servers to it, then revoke the old one.
- The callback is protected for you. Each attempt carries a fresh
stateand a PKCE verifier in an HttpOnly cookie scoped to your routes. A callback without them is refused, and the code is never exchanged. - Failure text is never taken from the URL. The browser shows fixed text for
declined,expiredandfailed. - Users stay in control. They narrow or revoke from their One dashboard at any time, and One applies it on the next call.
- One is SOC 2 Type II. To report a security issue, see SECURITY.md.
| Import | What it gives you |
|---|---|
@withone/connect |
<one-connect-button>, mountConnectButton, createConnectFlow, readConnectReturn |
@withone/connect/react |
ConnectButton, useOneConnect |
@withone/connect/vue |
ConnectButton |
@withone/connect/svelte |
connectButton, for use: |
@withone/connect/server |
createOneConnect, OneConnectError |
@withone/connect/next |
createOneConnectRoutes, for Next.js, Remix, SvelteKit, Hono and Bun |
@withone/connect/node |
createOneConnectHandlers, for Express, Fastify, Koa and plain Node |
@withone/connect/config |
defineConnectApp, to type one.connect.ts |
It needs Node.js 22 or later. React 17 and Vue 3 are optional peer dependencies. Every option, method and error code is in the reference.
From 1.0, Connect follows semantic versioning. A breaking change ships only in a major version. Every deprecation is marked in the types and in the release notes before it is removed.
- Bugs and questions go to GitHub issues.
- For security issues, see SECURITY.md. Please don't open a public issue.
- For everything else, write to support@withone.ai.
MIT. See LICENSE.


