The Users service in @owbase/node manages all of the project’s users with an API key: it’s what your backend uses to import accounts, build a support panel or flag special customers.
import { ID, Query, Users } from '@owbase/node';import { client } from './client';
// The key needs the users.read and users.write scopes.const users = new Users(client);
const bia = await users.create({ userId: ID.unique(), email: '[email protected]', password: 'a-strong-password', name: 'Bia' });
// Labels become a role in permissions: Role.label('vip').await users.updateLabels({ userId: bia.$id, labels: ['vip'] });
// Blocking (status false) prevents new sessions; true unblocks.await users.updateStatus({ userId: bia.$id, status: false });
const { users: vips } = await users.list({ queries: [Query.contains('labels', ['vip'])] });console.log(vips.map((u) => u.email));What you can do
Section titled “What you can do”- Create with email and password, with email only (the user signs in later through another method) or import passwords you already have hashed (
createBcryptUser,createArgon2Userand others). - Labels (
updateLabels): tags that become roles in permissions (Role.label('vip')). - Block (
updateStatuswithfalse): the user can’t open new sessions, and the ones they already have stop being valid (every request made with them is refused). - Sessions (
listSessions,deleteSessions): see and end someone’s sessions. - Preferences (
getPrefs,updatePrefs): a free-form object per user.
In the console, the same thing lives under Auth → Users.
Was this page helpful?Thanks for your feedback.