Entity Auth

Tenant Onboarding

Find your tenant ID and connect your app to Entity Auth

Entity Auth is multi‑tenant. Each workspace you create has a unique tenant ID, API base URL, and allowed origins list. The dashboard generates these values for you.

Use your own tenant ID

Always use the tenant ID from your own workspace dashboard when integrating and testing.

What is a tenant ID?

The tenant ID (often shown as tid) identifies the active organization/workspace for a user session. Most APIs are scoped to the current tenant.

Get your tenant ID

Create an account

Go to the dashboard at https://entity-auth.com/dashboard and sign up.

Create a workspace (tenant)

After sign‑in, create a new workspace/organization. This will generate a tenant for you.

Copy the .env snippet

Open the workspace Setup tab. Copy the generated snippet—it contains ENTITY_AUTH_WORKSPACE_TENANT_ID, NEXT_PUBLIC_ENTITY_AUTH_WORKSPACE_TENANT_ID, and NEXT_PUBLIC_ENTITY_AUTH_URL.

Use the tenant ID in your app

Initialize the SDK once with the copied values. Never ask users for workspaceTenantId.

// Web / Node.js
import { EntityAuthClient, init as initEA } from '@entityauth/auth-client';

initEA({
  workspaceTenantId: process.env.NEXT_PUBLIC_ENTITY_AUTH_WORKSPACE_TENANT_ID!,
  baseURL: process.env.NEXT_PUBLIC_ENTITY_AUTH_URL,
});

const ea = new EntityAuthClient({
  baseURL: process.env.NEXT_PUBLIC_ENTITY_AUTH_URL,
});

await ea.login({
  email: 'user@example.com',
  password: 'secure-password',
});
// Swift (iOS/macOS)
import EntityKit

let config = EntityAuthConfig(
    environment: .production,
    workspaceTenantId: "your-tenant-id",
    clientIdentifier: "ios-app"
)
let auth = EntityAuthFacade(config: config)

try await auth.login(request: .init(email: "user@example.com", password: "secure-password"))
let snapshot = await auth.currentSnapshot()
print(snapshot.userId ?? "no user")

Verify it works

  • After login, call ea.getUserMe() (Web) or inspect auth.currentSnapshot()/auth.userService.me() (Swift) to verify the session.
  • Create or switch organizations; the current tenant is reflected in the session context.
  • Check Allowed Origins in the dashboard to confirm your frontend domain is listed (localhost ports are seeded).

Troubleshooting

  • Invalid tenant ID (401/404): Ensure the .env values exactly match the dashboard snippet.
  • CORS errors: Add your app’s domain to the workspace Allowed Origins list and try again.
  • Custom domain pending: Verify the TXT record provided in the dashboard is present before clicking “Verify”.

Next steps