Skip to main content

Get started with site users

Create a site user — someone who signs in to your app — and read the new record back. Select the target site first. Organization membership is a separate Console workflow.

Before you start#

Use an account with organization access to the site or a Super Admin app role in one of its apps. Configure the JavaScript SDK, Python SDK, or Refine integration. The Refine example uses hosted sign-in and userDataProvider(taruvi) registered under the name user.

Create and verify a user#

Run this script on a server. Set TARUVI_SITE_URL, TARUVI_APP_SLUG, TARUVI_SESSION_TOKEN, and TARUVI_NEW_USER_PASSWORD in its environment. The session must belong to the account managing users.

import {Client, User} from '@taruvi/sdk';

const taruvi = new Client({
apiUrl: process.env.TARUVI_SITE_URL!,
appSlug: process.env.TARUVI_APP_SLUG!,
token: process.env.TARUVI_SESSION_TOKEN!,
});
const users = new User(taruvi);
const initialPassword = process.env.TARUVI_NEW_USER_PASSWORD;
if (!initialPassword) throw new Error("Set TARUVI_NEW_USER_PASSWORD");

const created = await users.createUser({
username: "onboarding-user",
password: initialPassword,
confirm_password: initialPassword,
first_name: "Onboarding",
last_name: "User",
});
const verified = await users.getUser(created.data.username);
console.log(verified.data.username);

The browser client ignores token; use hosted sign-in instead of supplying a session through the constructor.

Verify the result#

Confirm the read returns the username you created in the selected site (onboarding-user in the SDK and Refine examples). Replace the example username and email before creating a real account. If creation fails validation, fix the rejected value and try again. Share the initial password with the user securely; never put it in source control, a ticket, or a screenshot.

Continue with site users to list, update, and remove users, or assign user access to grant a role. For unresolved failures, see troubleshooting.