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.
Yes. Connect unlimited creators to one dashboard, each isolated from the others.
Yes. The hosted modal takes two lines of JavaScript and can be themed to match your app.
Keys can be limited per project, per teammate or per creator, with audit logs for every call.
Request access with the short form. Tell us what you want to build and our team will follow up with the right next step.
Keep exploring
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.