4based/API
Auth

The Auth Module built for 4based

4based API authentication as a drop-in connection flow for creator accounts with 2FA support, encrypted session vaulting and automatic session refresh.

Full connection flow

Including the two-factor step, error states and retries.

Session vaulting

AES-256, per-tenant, auto-refresh.

Drop-in modal

Two lines of JS, themeable.

Multi-account

Unlimited creators, no cross-contamination.

Scoped access

Per creator, per teammate.

Recovery flows

Expired sessions are detected and cleanly reconnected.

auth.ts
// auth.ts
import { FourbasedAuth, FourbasedApi } from "@4basedapi/sdk";

const auth = new FourbasedAuth({ apiKey: process.env.FOURBASED_API_KEY });
const { accountId } = await auth.connect({
  onTwoFactorRequired: async () => prompt("Enter your 2FA code"),
});

const api = new FourbasedApi({ apiKey: process.env.FOURBASED_API_KEY });
await api.chats.send({ accountId, fanId: "fan_9821", text: "Hi" });

Connection happens only inside the Auth Module within your own product. This website never asks for 4based credentials.

Frequently asked questions

A drop-in connection flow links creator accounts with 2FA support, encrypts sessions with AES-256 and refreshes them automatically.

Build with 4based API

Ready to build?

Tell us what you want to automate, measure or build on top of 4based. Agencies, developers and automation teams all get a tailored next step from our team.