Skip to content
Orvanov0.2.0

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.

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 })

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)
}

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)

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' })

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.

users.delete deletes the user, their password, and every session, for good.

await orvano.users.delete(userId)

A user ID that doesn’t exist gets user_not_found. The console’s Users page does all of this by hand.