Manage users with an API key
Your own servers and support tools manage a project’s users through users, with an API key. Reading needs the users.read scope; everything that changes a user needs users.write. Create the key in the console (API keys) and read it from the environment.
The snippets assume a server client, as in the Dart and .NET quickstarts or @orvano/js/server.
Create a user
Section titled “Create a user”users.create creates a user with a password, for example when you import users or invite them yourself. It doesn’t sign them in. Pass emailVerified: true only when you’ve already checked the email.
const user = await orvano.users.create({ email, password, name })final user = await orvano.users.create( CreateUserRequest(email: email, password: password, name: name),);var user = await orvano.Users.CreateAsync(new CreateUserRequest(email, password, Name: name));Find users
Section titled “Find users”users.get reads one user by ID, and users.list lists them, newest first. Filter by email (matches the start), status, emailVerified, createdAfter, and createdBefore. listAll walks every page:
for await (const user of orvano.users.listAll({ emailVerified: false })) { console.log(user.email)}await for (final user in orvano.users.listAll(emailVerified: false)) { print(user.email);}await foreach (var user in orvano.Users.ListAllAsync(emailVerified: false)){ Console.WriteLine(user.Email);}Block and unblock
Section titled “Block and unblock”users.block ends every session of the user and stops them from signing in; they get user_blocked. users.unblock lets them sign in again, but their old sessions stay ended.
await orvano.users.block(userId)await orvano.users.unblock(userId)await orvano.users.block(userId);await orvano.users.unblock(userId);await orvano.Users.BlockAsync(userId);await orvano.Users.UnblockAsync(userId);Send a verification or reset email
Section titled “Send a verification or reset email”users.createVerification and users.createRecovery send the user the same emails as Email verification and Password reset, to a redirectUrl of your app:
await orvano.users.createRecovery(userId, { redirectUrl: 'https://app.example.com/auth/reset' })await orvano.users.createRecovery( userId, const CreateUserRecoveryRequest(redirectUrl: 'https://app.example.com/auth/reset'),);await orvano.Users.CreateRecoveryAsync(userId, new CreateUserRecoveryRequest("https://app.example.com/auth/reset"));Change a user’s email
Section titled “Change a user’s email”users.updateEmail changes the email at once, with no confirmation email, and keeps the user’s sessions. users.updateEmailVerification marks the email verified or not.
Delete a user
Section titled “Delete a user”users.delete deletes the user, their password, and every session, for good.
await orvano.users.delete(userId)await orvano.users.delete(userId);await orvano.Users.DeleteAsync(userId);A user ID that doesn’t exist gets user_not_found. The console’s Users page does all of this by hand.