Docs

Python: Authentication

Sign app users up and in with passwords, magic links, SMS codes and providers; manage sessions, MFA, passkeys, app users and roles with the Python SDK.

Updated Nov 25, 2026

Sign app users — the people who use your app — in and out of your project. After sign_in, every call from this client runs as that user, so your policies and row-level security apply.

App roles (sovaria.roles): await sovaria.roles.create("MANAGER", ["read"]), list(), update(), delete(), status(); await sovaria.roles.assign(user_id, "MANAGER") / revoke(user_id, "MANAGER") keep the user's other roles; sovaria.roles.current() / has("manager") read the signed-in user's token (UI only — the server checks every call). A role given or taken applies to the user's requests within 20 seconds (usually at once), even with the token they already hold, and they stay signed in; current() shows the change after the token refreshes. Row rules test roles with auth.has_role('manager').

from sovaria import create_client

sovaria = create_client("https://<project-ref>.sovarias.in", "<anon-key>")
await sovaria.sign_up("ada@example.com", "Correct-Horse-9!", "Ada")
await sovaria.sign_in("ada@example.com", "Correct-Horse-9!")
me = await sovaria.get_me()
await sovaria.logout()

#Methods

sovaria.ban_product_user

Ban a product user in the resolved scope (banned=False unbans).

await sovaria.ban_product_user(
    user_id: str,
    *, org_id: str | None = None,
    project_id: str | None = None,
    env_id: str | None = None,
    banned: bool = True,
) -> dict[str, Any]

A repeated call keeps the state.

Parameters

user_idstrrequired
org_idstr | Noneoptionaldefault None
project_idstr | Noneoptionaldefault None
env_idstr | Noneoptionaldefault None
bannedbooloptionaldefault True

Returns

dict[str, Any]

{
  "user_id": "3c8f1e2a-9b47-4d6e-a5c1-7f0e2d4b8a93",
  "is_active": false
}

sovaria.confirm_verification_email

Confirm an email verification token.

await sovaria.confirm_verification_email(token: str) -> dict[str, Any]

A signed-in client sends its session: a confirmation from the account's own session only confirms; one from elsewhere also marks the account so the inbox owner's first email sign-in ends whatever was set before the address was proven.

Parameters

tokenstrrequired

Returns

dict[str, Any]

{
  "status": "verified",
  "user_id": "6e19c0a2-3f5b-4a8e-9b1d-0c7f2e8a4d51"
}

sovaria.console_login

Strict console-lane login for Sovaria operators.

await sovaria.console_login(email: str, password: str) -> TokenResponse

Parameters

emailstrrequired
passwordstrrequired

Returns

TokenResponse

sovaria.create_event_hook

Create event hook.

await sovaria.create_event_hook(body: dict[str, Any]) -> dict[str, Any]

Parameters

bodydict[str, Any]required

Returns

dict[str, Any]

{
  "id": "0b6e…",
  "name": "CRM sync",
  "url": "https://hooks.skolist.com/sovaria-auth",
  "events": [
    "auth.user.login.success",
    "auth.user.registered"
  ],
  "enabled": true,
  "created_at": "2026-10-18T10:10:00+00:00",
  "updated_at": "2026-10-18T10:10:00+00:00",
  "delivery_count": 0,
  "failure_count": 0,
  "last_delivery_at": null,
  "last_error": null
}

sovaria.create_product_user

Create product user.

await sovaria.create_product_user(
    body: dict[str, Any],
    *, org_id: str | None = None,
    project_id: str | None = None,
    env_id: str | None = None,
) -> dict[str, Any]

Parameters

bodydict[str, Any]required
org_idstr | Noneoptionaldefault None
project_idstr | Noneoptionaldefault None
env_idstr | Noneoptionaldefault None

Returns

dict[str, Any]

{
  "id": "a71d0c5e-2f84-4b9a-9e13-6c5d8f2b1a47",
  "node_id": "3c8f1e2a-9b47-4d6e-a5c1-7f0e2d4b8a93",
  "email": "ana@example.com",
  "is_active": true,
  "created_at": "2026-10-02T08:14:22.481Z",
  "updated_at": "2026-10-16T19:03:51.112Z",
  "mfa_enabled": false,
  "phone_mfa_enabled": false,
  "any_mfa_enabled": false,
  "last_sign_in_at": null,
  "roles": [
    "staff"
  ],
  "role_sources": [
    "project_settings"
  ],
  "project_id": "f0c3e9a2-1b4d-4e7f-8a6c-2d9b5e3f1a07",
  "actor_lane": "product",
  "auth_subject_type": "product_user",
  "pending_invite": true
}

sovaria.create_saml_connection

Connect a customer's IdP from its metadata XML, or from entity ID + sign-in URL + certificate.

await sovaria.create_saml_connection(
    name: str,
    domains: list[str],
    *, metadata_xml: str | None = None,
    idp_entity_id: str | None = None,
    idp_sso_url: str | None = None,
    idp_certificate_pem: str | None = None,
    email_attribute: str = 'email',
) -> dict[str, Any]

Parameters

namestrrequired
domainslist[str]required
metadata_xmlstr | Noneoptionaldefault None
idp_entity_idstr | Noneoptionaldefault None
idp_sso_urlstr | Noneoptionaldefault None
idp_certificate_pemstr | Noneoptionaldefault None
email_attributestroptionaldefault 'email'

Returns

dict[str, Any]

{
  "id": "3c9a7e21-5b4d-4f08-9a6e-1d2c3b4a5f60",
  "name": "Acme Okta",
  "domains": [
    "acme.com"
  ],
  "enabled": true,
  "idp_entity_id": "http://www.okta.com/exk1a2b3c",
  "idp_sso_url": "https://acme.okta.com/app/acme_sovaria/exk1a2b3c/sso/saml",
  "email_attribute": "email",
  "name_attribute": "displayName",
  "created_at": "2026-10-25T09:12:00Z",
  "certificate_set": true,
  "sp_entity_id": "https://api.sovaria.in/api/v1/auth/sso/saml/3c9a7e21-5b4d-4f08-9a6e-1d2c3b4a5f60/metadata",
  "acs_url": "https://api.sovaria.in/api/v1/auth/sso/saml/3c9a7e21-5b4d-4f08-9a6e-1d2c3b4a5f60/acs",
  "metadata_url": "https://api.sovaria.in/api/v1/auth/sso/saml/3c9a7e21-5b4d-4f08-9a6e-1d2c3b4a5f60/metadata"
}

sovaria.create_scim_token

Turn SCIM on or rotate its token (the old one stops at once); the token is returned once.

await sovaria.create_scim_token() -> dict[str, Any]

Returns

dict[str, Any]

{
  "token": "scim_…",
  "base_url": "https://api.sovaria.in/api/v1/auth/scim/v2/c0ffee00-…",
  "rotated": false,
  "token_info": {
    "prefix": "scim_Xb3kQ9",
    "created_at": "2026-10-23T09:00:00Z",
    "created_by": "8d1e…",
    "last_used_at": null
  }
}

sovaria.delete_blocking_hook

Delete blocking hook.

await sovaria.delete_blocking_hook(event: str) -> dict[str, Any]

Parameters

eventstrrequired

Returns

dict[str, Any]

sovaria.delete_event_hook

Delete event hook.

await sovaria.delete_event_hook(hook_id: str) -> dict[str, Any]

Parameters

hook_idstrrequired

Returns

dict[str, Any]

sovaria.delete_passkey

Remove one of the signed-in user's passkeys.

await sovaria.delete_passkey(passkey_id: str) -> None

Parameters

passkey_idstrrequired

Returns

None

sovaria.delete_product_user

Delete a product user credential in the resolved scope.

await sovaria.delete_product_user(
    user_id: str,
    *, org_id: str | None = None,
    project_id: str | None = None,
    env_id: str | None = None,
) -> dict[str, Any]

Parameters

user_idstrrequired
org_idstr | Noneoptionaldefault None
project_idstr | Noneoptionaldefault None
env_idstr | Noneoptionaldefault None

Returns

dict[str, Any]

sovaria.delete_saml_connection

Delete saml connection.

await sovaria.delete_saml_connection(connection_id: str) -> None

Parameters

connection_idstrrequired

Returns

None

sovaria.disable_mfa

Disable mfa.

await sovaria.disable_mfa(totp_code: str) -> dict[str, Any]

Parameters

totp_codestrrequired

Returns

dict[str, Any]

{
  "status": "disabled",
  "message": "MFA has been removed"
}

sovaria.disconnect_github

Disconnect github.

await sovaria.disconnect_github(*, project_id: str) -> dict[str, Any]

Parameters

project_idstrrequired

Returns

dict[str, Any]

{
  "provider": "github",
  "project_scope": "f0c3e9a2-1b4d-4e7f-8a6c-2d9b5e3f1a07",
  "connected": false,
  "disconnected": true
}

sovaria.enroll_mfa

Enroll mfa.

await sovaria.enroll_mfa() -> dict[str, Any]

Returns

dict[str, Any]

{
  "secret": "JBSWY3DPEHPK3PXP",
  "totp_uri": "otpauth://totp/skolist-shop:ada%40example.com?secret=JBSWY3DPEHPK3PXP&issuer=skolist-shop",
  "qr_data": "otpauth://totp/skolist-shop:ada%40example.com?secret=JBSWY3DPEHPK3PXP&issuer=skolist-shop",
  "backup_codes": [
    "f3Kx9_q2Lw8",
    "Qm7-pT2vX0a",
    "…"
  ]
}

sovaria.fn_github_commit

Fn github commit.

await sovaria.fn_github_commit(body: dict[str, Any]) -> dict[str, Any]

Parameters

bodydict[str, Any]required

Returns

dict[str, Any]

sovaria.fn_github_import

Fn github import.

await sovaria.fn_github_import(body: dict[str, Any]) -> dict[str, Any]

Parameters

bodydict[str, Any]required

Returns

dict[str, Any]

sovaria.fn_list_github_repos

Fn list github repos.

await sovaria.fn_list_github_repos(
    *, token: str | None = None,
    limit: int = 40,
) -> dict[str, Any]

Parameters

tokenstr | Noneoptionaldefault None
limitintoptionaldefault 40

Returns

dict[str, Any]

sovaria.get_blocking_hooks

Both blocking hooks (no secrets), the plan gate and the staff switch.

await sovaria.get_blocking_hooks() -> dict[str, Any]

Returns

dict[str, Any]

{
  "before_create": null,
  "before_sign_in": {
    "target": "webhook",
    "url": "https://api.acme.com/hooks/before-sign-in",
    "function": null,
    "timeout_ms": 1500,
    "fail": "closed",
    "enabled": true,
    "updated_at": "2026-10-23T09:00:00Z",
    "updated_by": "8d1e…",
    "has_secret": true
  },
  "plan_allowed": true,
  "disabled_by_staff": false,
  "disabled_reason": null,
  "max_timeout_ms": 5000
}

sovaria.get_github_connection_state

Get github connection state.

await sovaria.get_github_connection_state(
    *, project_id: str,
) -> dict[str, Any]

Parameters

project_idstrrequired

Returns

dict[str, Any]

{
  "provider": "github",
  "project_scope": "f0c3e9a2-1b4d-4e7f-8a6c-2d9b5e3f1a07",
  "connected": true,
  "connected_at": "2026-10-04T15:20:00Z",
  "updated_at": "2026-10-04T15:20:00Z",
  "token_hint": "gho_…1f",
  "metadata": {
    "email": "dev@skolist.com",
    "login": "skolist-dev",
    "name": "Skolist Dev",
    "scopes": [
      "read:user",
      "repo",
      "user:email"
    ]
  }
}

sovaria.get_me

Return the authenticated user's profile (user_id, email, roles).

await sovaria.get_me() -> dict[str, Any]

Returns

dict[str, Any]

sovaria.get_mfa_status

Get mfa status.

await sovaria.get_mfa_status() -> dict[str, Any]

Returns

dict[str, Any]

{
  "mfa_enabled": true,
  "phone_mfa_enabled": false,
  "enrolled_at": "2026-10-02T09:14:07Z"
}

sovaria.get_product_user_roles

Return a product user's app roles in the resolved scope.

await sovaria.get_product_user_roles(
    user_id: str,
    *, org_id: str | None = None,
    project_id: str | None = None,
    env_id: str | None = None,
) -> dict[str, Any]

Parameters

user_idstrrequired
org_idstr | Noneoptionaldefault None
project_idstr | Noneoptionaldefault None
env_idstr | Noneoptionaldefault None

Returns

dict[str, Any]

{
  "user_id": "3c8f1e2a-9b47-4d6e-a5c1-7f0e2d4b8a93",
  "org_id": "b2f4a1c8-7d3e-4f0a-9c6b-5e8d2a1f3c90",
  "project_id": "f0c3e9a2-1b4d-4e7f-8a6c-2d9b5e3f1a07",
  "roles": [
    "staff"
  ]
}

sovaria.get_providers_config

Get providers config.

await sovaria.get_providers_config() -> dict[str, Any]

Returns

dict[str, Any]

{
  "providers": [
    {
      "id": "email",
      "label": "Email + Password",
      "enabled": true,
      "requested_enabled": true,
      "available": true,
      "managed_by": "core",
      "description": "Built-in credential authentication.",
      "setup_required": []
    },
    {
      "id": "magic_link",
      "label": "Magic Link",
      "enabled": true,
      "requested_enabled": true,
      "available": true,
      "managed_by": "core",
      "description": "…",
      "setup_required": []
    }
  ],
  "database_link": {
    "enabled": false,
    "engine": "postgresql",
    "host": "",
    "port": 5432,
    "database": "",
    "schema": "public",
    "username": "",
    "ssl": true
  },
  "sms_config": {
    "provider": "twilio",
    "account_sid": "AC5f…",
    "from_number": "+14155550123",
    "auth_token_set": true,
    "auth_token_hint": "8c…f2"
  }
}

sovaria.get_scim_status

Whether SCIM is on, the base URL for the identity provider, the token's prefix and last use, counts.

await sovaria.get_scim_status() -> dict[str, Any]

Returns

dict[str, Any]

{
  "enabled": true,
  "base_url": "https://api.sovaria.in/api/v1/auth/scim/v2/c0ffee00-…",
  "token": {
    "prefix": "scim_Xb3kQ9",
    "created_at": "2026-10-23T09:00:00Z",
    "created_by": "8d1e…",
    "last_used_at": "2026-10-23T10:12:00Z"
  },
  "plan_allowed": true,
  "disabled_by_staff": false,
  "disabled_reason": null,
  "users_provisioned": 42,
  "groups": 3
}

sovaria.get_sessions_config

Get sessions config.

await sovaria.get_sessions_config() -> dict[str, Any]

Returns

dict[str, Any]

{
  "timeout_minutes": 15,
  "refresh_days": 7,
  "max_concurrent": 0,
  "single_session": false
}

sovaria.import_product_users

Bulk-import app users (up to 1,000 per call) with their ids and password hashes. Each user: email (required), id, email_verified, phone, display_name and, for a password, password_algorithm ("bcrypt" or "firebase_scrypt"), password_hash and, for Firebase, password_salt.

await sovaria.import_product_users(
    users: list[dict[str, Any]],
    *, hash_config: dict[str, Any] | None = None,
    org_id: str | None = None,
    project_id: str | None = None,
) -> dict[str, Any]

hash_config holds the Firebase project's signer_key, salt_separator, rounds and mem_cost (stored encrypted). No emails, hooks or triggers fire; existing emails are skipped. Org owners/admins only. Returns {"imported": [...], "skipped": [...], "failed": [...], "counts": {...}}.

Parameters

userslist[dict[str, Any]]required
hash_configdict[str, Any] | Noneoptionaldefault None
org_idstr | Noneoptionaldefault None
project_idstr | Noneoptionaldefault None

Returns

dict[str, Any]

{
  "imported": [
    {
      "user": "ana@example.com",
      "id": "3c8f1e2a-9b47-4d6e-a5c1-7f0e2d4b8a93",
      "source_id": "3c8f1e2a-9b47-4d6e-a5c1-7f0e2d4b8a93",
      "password": "bcrypt"
    },
    {
      "user": "li@example.com",
      "id": "9e2b…",
      "source_id": "kX9fF2…",
      "password": "firebase_scrypt"
    }
  ],
  "skipped": [
    {
      "user": "old@example.com",
      "reason": "already in this project"
    }
  ],
  "failed": [
    {
      "user": "bad",
      "reason": "missing or invalid email"
    }
  ],
  "counts": {
    "imported": 2,
    "skipped": 1,
    "failed": 1
  }
}

sovaria.list_console_product_users

List console product users.

await sovaria.list_console_product_users() -> list[dict[str, Any]]

Returns

list[dict[str, Any]]

[
  {
    "id": "a71d0c5e-2f84-4b9a-9e13-6c5d8f2b1a47",
    "node_id": "3c8f1e2a-9b47-4d6e-a5c1-7f0e2d4b8a93",
    "email": "ana@example.com",
    "is_active": true,
    "created_at": "2026-10-02T08:14:22.481Z",
    "updated_at": "2026-10-16T19:03:51.112Z",
    "mfa_enabled": false,
    "phone_mfa_enabled": false,
    "any_mfa_enabled": false,
    "last_sign_in_at": "2026-10-17T09:41:05.330Z",
    "roles": [
      "staff"
    ],
    "role_sources": [
      "project_settings"
    ],
    "project_id": "f0c3e9a2-1b4d-4e7f-8a6c-2d9b5e3f1a07"
  }
]

sovaria.list_event_hooks

List event hooks.

await sovaria.list_event_hooks() -> list[dict[str, Any]]

Returns

list[dict[str, Any]]

[
  {
    "id": "0b6e…",
    "name": "CRM sync",
    "url": "https://hooks.skolist.com/sovaria-auth",
    "events": [
      "auth.user.login.success",
      "auth.user.registered"
    ],
    "enabled": true,
    "created_at": "2026-10-01T10:00:00+00:00",
    "updated_at": "2026-10-01T10:00:00+00:00",
    "delivery_count": 412,
    "failure_count": 3,
    "last_delivery_at": "2026-10-17T09:41:05+00:00",
    "last_error": null
  }
]

sovaria.list_passkeys

The signed-in user's passkeys (id, name, created_at, last_used_at). Creating and using passkeys happens in the user's browser or app (WebAuthn); from Python, sovaria.api.auth.passkey_* exposes the raw start/finish calls for custom flows.

await sovaria.list_passkeys() -> list[dict[str, Any]]

Returns

list[dict[str, Any]]

sovaria.list_product_users

Every project/product user in the resolved org/project scope (follows the API's pages). For large projects prefer list_product_users_page and page with next_cursor.

await sovaria.list_product_users(
    *, org_id: str | None = None,
    project_id: str | None = None,
    env_id: str | None = None,
) -> list[dict[str, Any]]

Parameters

org_idstr | Noneoptionaldefault None
project_idstr | Noneoptionaldefault None
env_idstr | Noneoptionaldefault None

Returns

list[dict[str, Any]]

sovaria.list_product_users_page

One page of product users, newest first: {"users", "next_cursor", "total"}. search matches part of an email or an exact user id; status is active or banned.

await sovaria.list_product_users_page(
    *, org_id: str | None = None,
    project_id: str | None = None,
    env_id: str | None = None,
    limit: int = 50,
    cursor: str | None = None,
    search: str | None = None,
    status: str | None = None,
) -> dict[str, Any]

total (for the filter) comes with the first page.

Parameters

org_idstr | Noneoptionaldefault None
project_idstr | Noneoptionaldefault None
env_idstr | Noneoptionaldefault None
limitintoptionaldefault 50
Page size.
cursorstr | Noneoptionaldefault None
next_cursor from the previous page.
searchstr | Noneoptionaldefault None
Part of an email or name.
statusstr | Noneoptionaldefault None

Returns

dict[str, Any]

cursor = None
while True:
    page = await sovaria.list_product_users_page(limit=100, cursor=cursor)
    for user in page["users"]:
        print(user["email"])
    cursor = page.get("next_cursor")
    if not cursor:
        break

sovaria.list_saml_connections

The project's SAML connections for app-user single sign-on (certificates never returned).

await sovaria.list_saml_connections() -> list[dict[str, Any]]

Returns

list[dict[str, Any]]

[
  {
    "id": "3c9a7e21-5b4d-4f08-9a6e-1d2c3b4a5f60",
    "name": "Acme Okta",
    "domains": [
      "acme.com"
    ],
    "enabled": true,
    "idp_entity_id": "http://www.okta.com/exk1a2b3c",
    "idp_sso_url": "https://acme.okta.com/app/acme_sovaria/exk1a2b3c/sso/saml",
    "email_attribute": "email",
    "name_attribute": "displayName",
    "created_at": "2026-10-25T09:12:00Z",
    "certificate_set": true,
    "sp_entity_id": "https://api.sovaria.in/api/v1/auth/sso/saml/3c9a7e21-5b4d-4f08-9a6e-1d2c3b4a5f60/metadata",
    "acs_url": "https://api.sovaria.in/api/v1/auth/sso/saml/3c9a7e21-5b4d-4f08-9a6e-1d2c3b4a5f60/acs",
    "metadata_url": "https://api.sovaria.in/api/v1/auth/sso/saml/3c9a7e21-5b4d-4f08-9a6e-1d2c3b4a5f60/metadata"
  }
]

sovaria.list_sessions

List sessions.

await sovaria.list_sessions() -> list[dict[str, Any]]

Returns

list[dict[str, Any]]

[
  {
    "id": "sess_8f2…",
    "device": "Chrome on macOS",
    "ip": "203.0.113.24",
    "last_active_at": "2026-10-17T12:30:01Z",
    "expires_in_seconds": 600391,
    "current": true
  },
  {
    "id": "sess_1c7…",
    "device": "Safari on iPhone",
    "ip": "198.51.100.7",
    "last_active_at": "2026-10-15T08:11:40Z",
    "expires_in_seconds": 412044,
    "current": false
  }
]

sovaria.login

Deprecated compatibility login. Unscoped calls post to POST /api/v1/auth/console/login.

await sovaria.login(email: str, password: str) -> TokenResponse

When set_scope(org_id, project_id) has been called, posts to POST /api/v1/auth/project/login. Prefer console_login() or project_login() in new code.

Parameters

emailstrrequired
passwordstrrequired

Returns

TokenResponse

sovaria.login_console

Alias for console_login(), matching TypeScript lane terminology.

await sovaria.login_console(email: str, password: str) -> TokenResponse

Parameters

emailstrrequired
passwordstrrequired

Returns

TokenResponse

sovaria.login_product

Alias for project_login(), matching TypeScript lane terminology.

await sovaria.login_product(
    email: str,
    password: str,
    *, org_id: str | None = None,
    project_id: str | None = None,
    env_id: str | None = None,
) -> TokenResponse

Parameters

emailstrrequired
passwordstrrequired
org_idstr | Noneoptionaldefault None
project_idstr | Noneoptionaldefault None
env_idstr | Noneoptionaldefault None

Returns

TokenResponse

sovaria.logout

Revoke the active refresh token server-side, then clear in-memory tokens. Sends Authorization: Bearer plus {"refresh_token": ...}.

await sovaria.logout() -> None

Non-2xx responses are treated as failure. Local session state (tokens + KEK) is always cleared, including when the HTTP call fails.

Returns

None

sovaria.oauth_handoff

Exchange an OAuth handoff token for a session. Passwordless: session KEK is not derived unless password is supplied and the response includes argon2_salt.

await sovaria.oauth_handoff(
    token: str,
    password: str | None = None,
) -> TokenResponse

Parameters

tokenstrrequired
passwordstr | Noneoptionaldefault None

Returns

TokenResponse

sovaria.product_users_list

Alias for list_product_users(), matching TypeScript productUsers.list().

await sovaria.product_users_list(**kwargs) -> list[dict[str, Any]]

Returns

list[dict[str, Any]]

sovaria.product_users_set_roles

Alias for replace_product_user_roles(), matching TypeScript productUsers.setRoles().

await sovaria.product_users_set_roles(
    user_id: str,
    roles: list[str],
    **kwargs,
) -> dict[str, Any]

Parameters

user_idstrrequired
The app user's id.
roleslist[str]required
App roles, e.g. ["librarian"] (policies use app:<role>).

Returns

dict[str, Any]

sovaria.project_login

Strict project-lane login for product end-users.

await sovaria.project_login(
    email: str,
    password: str,
    *, org_id: str | None = None,
    project_id: str | None = None,
    env_id: str | None = None,
    captcha_token: str | None = None,
) -> TokenResponse

Parameters

emailstrrequired
passwordstrrequired
org_idstr | Noneoptionaldefault None
project_idstr | Noneoptionaldefault None
env_idstr | Noneoptionaldefault None
captcha_tokenstr | Noneoptionaldefault None

Returns

TokenResponse

sovaria.register

Create an app user in a project (or, with no project scope at all, a Sovaria console account). The project comes from org_id/project_id or the client's scope (set_scope).

await sovaria.register(
    email: str,
    password: str,
    name: str,
    *, org_id: str | None = None,
    project_id: str | None = None,
    env_id: str | None = None,
    captcha_token: str | None = None,
    data: dict[str, Any] | None = None,
) -> TokenResponse

Without either, the account created is a console account — app code should always pass a scope. Registration may not return tokens when the project requires email verification.

Parameters

emailstrrequired
passwordstrrequired
namestrrequired
org_idstr | Noneoptionaldefault None
project_idstr | Noneoptionaldefault None
env_idstr | Noneoptionaldefault None
captcha_tokenstr | Noneoptionaldefault None
datadict[str, Any] | Noneoptionaldefault None

Returns

TokenResponse

sovaria.replace_product_user_roles

Replace a product user's app roles in the resolved scope.

await sovaria.replace_product_user_roles(
    user_id: str,
    roles: list[str],
    *, org_id: str | None = None,
    project_id: str | None = None,
    env_id: str | None = None,
) -> dict[str, Any]

Parameters

user_idstrrequired
roleslist[str]required
org_idstr | Noneoptionaldefault None
project_idstr | Noneoptionaldefault None
env_idstr | Noneoptionaldefault None

Returns

dict[str, Any]

{
  "user_id": "3c8f1e2a-9b47-4d6e-a5c1-7f0e2d4b8a93",
  "org_id": "b2f4a1c8-7d3e-4f0a-9c6b-5e8d2a1f3c90",
  "project_id": "f0c3e9a2-1b4d-4e7f-8a6c-2d9b5e3f1a07",
  "roles": [
    "billing",
    "staff"
  ]
}

sovaria.revoke_other_sessions

Sign out every other device; this session stays (its refresh token tells the server which one it is).

await sovaria.revoke_other_sessions() -> dict[str, Any]

Returns

dict[str, Any]

sovaria.revoke_scim_token

Revoke scim token.

await sovaria.revoke_scim_token() -> dict[str, Any]

Returns

dict[str, Any]

sovaria.revoke_session

Revoke session.

await sovaria.revoke_session(session_id: str) -> dict[str, Any]

Parameters

session_idstrrequired

Returns

dict[str, Any]

sovaria.send_otp

Send an SMS OTP code for phone-based login (create_user signs an unknown number up).

await sovaria.send_otp(
    phone: str,
    *, org_id: str | None = None,
    project_id: str | None = None,
    env_id: str | None = None,
    create_user: bool | None = None,
    data: dict[str, Any] | None = None,
    captcha_token: str | None = None,
) -> dict[str, Any]

Parameters

phonestrrequired
org_idstr | Noneoptionaldefault None
project_idstr | Noneoptionaldefault None
env_idstr | Noneoptionaldefault None
create_userbool | Noneoptionaldefault None
datadict[str, Any] | Noneoptionaldefault None
captcha_tokenstr | Noneoptionaldefault None

Returns

dict[str, Any]

{
  "status": "accepted"
}

sovaria.send_verification_email

Trigger a verification email for the authenticated user.

await sovaria.send_verification_email() -> dict[str, Any]

Returns

dict[str, Any]

{
  "status": "sent"
}

sovaria.set_blocking_hook

Point before_create / before_sign_in at a webhook (url) or a function; returns the signing secret once (secret) when it is created or rotated.

await sovaria.set_blocking_hook(
    event: str,
    *, url: str | None = None,
    function: str | None = None,
    timeout_ms: int | None = None,
    fail: str = 'closed',
    enabled: bool = True,
    rotate_secret: bool = False,
) -> dict[str, Any]

Parameters

eventstrrequired
urlstr | Noneoptionaldefault None
functionstr | Noneoptionaldefault None
timeout_msint | Noneoptionaldefault None
failstroptionaldefault 'closed'
enabledbooloptionaldefault True
rotate_secretbooloptionaldefault False

Returns

dict[str, Any]

{
  "target": "webhook",
  "url": "https://api.acme.com/hooks/before-sign-in",
  "function": null,
  "timeout_ms": 1500,
  "fail": "closed",
  "enabled": true,
  "updated_at": "2026-10-23T09:00:00Z",
  "updated_by": "8d1e…",
  "has_secret": true,
  "secret": "whsec_…"
}

sovaria.sign_in

Sign an app user in with email and password (same as project_login).

await sovaria.sign_in(email: str, password: str) -> TokenResponse

Parameters

emailstrrequired
The user's email.
passwordstrrequired
Their password.

Returns

TokenResponse

try:
    await sovaria.sign_in(email, password)
except SovariaError as err:
    if err.status_code == 401:
        print("Wrong email or password")
    else:
        raise

sovaria.sign_up

Create an app user and sign them in (unless the project requires email confirmation).

await sovaria.sign_up(
    email: str,
    password: str,
    name: str = '',
) -> TokenResponse

Parameters

emailstrrequired
The user's email.
passwordstrrequired
Must meet the project's password rules.
namestroptionaldefault ''
Display name.

Returns

TokenResponse

  • 403 SIGNUP_DISABLED when new sign-ups are off.

sovaria.test_blocking_hook

Send a sample event; returns allowed, claims, message, failed, error, latency_ms.

await sovaria.test_blocking_hook(
    event: str,
    *, email: str | None = None,
) -> dict[str, Any]

Parameters

eventstrrequired
emailstr | Noneoptionaldefault None

Returns

dict[str, Any]

{
  "allowed": false,
  "claims": {},
  "message": "Use your Acme email.",
  "failed": false,
  "error": null,
  "latency_ms": 84.2
}

sovaria.update_providers_config

Update providers config.

await sovaria.update_providers_config(
    body: dict[str, Any],
) -> dict[str, Any]

Parameters

bodydict[str, Any]required

Returns

dict[str, Any]

sovaria.update_saml_connection

Change a connection: enabled, domains, name, certificate (idp_certificate_pem) or metadata_xml.

await sovaria.update_saml_connection(
    connection_id: str,
    **changes,
) -> dict[str, Any]

Parameters

connection_idstrrequired

Returns

dict[str, Any]

{
  "id": "3c9a7e21-5b4d-4f08-9a6e-1d2c3b4a5f60",
  "name": "Acme Okta",
  "domains": [
    "acme.com"
  ],
  "enabled": false,
  "idp_entity_id": "http://www.okta.com/exk1a2b3c",
  "idp_sso_url": "https://acme.okta.com/app/acme_sovaria/exk1a2b3c/sso/saml",
  "email_attribute": "email",
  "name_attribute": "displayName",
  "created_at": "2026-10-25T09:12:00Z",
  "certificate_set": true,
  "sp_entity_id": "https://api.sovaria.in/api/v1/auth/sso/saml/3c9a7e21-5b4d-4f08-9a6e-1d2c3b4a5f60/metadata",
  "acs_url": "https://api.sovaria.in/api/v1/auth/sso/saml/3c9a7e21-5b4d-4f08-9a6e-1d2c3b4a5f60/acs",
  "metadata_url": "https://api.sovaria.in/api/v1/auth/sso/saml/3c9a7e21-5b4d-4f08-9a6e-1d2c3b4a5f60/metadata",
  "updated_at": "2026-10-25T10:00:00Z"
}

sovaria.update_sessions_config

Update sessions config.

await sovaria.update_sessions_config(
    body: dict[str, Any],
) -> dict[str, Any]

Parameters

bodydict[str, Any]required

Returns

dict[str, Any]

{
  "timeout_minutes": 30,
  "refresh_days": 14,
  "max_concurrent": 5,
  "single_session": false
}

sovaria.verify_mfa

Complete MFA using a pre-MFA challenge token from login.

await sovaria.verify_mfa(
    code: str,
    *, method: str = 'totp',
) -> TokenResponse

Parameters

codestrrequired
methodstroptionaldefault 'totp'

Returns

TokenResponse

sovaria.verify_otp

Verify an SMS OTP code and establish a session. Passwordless by default: pass password when argon2_salt is present if you need session-cached E2EE without a follow-up login.

await sovaria.verify_otp(
    phone: str,
    code: str,
    *, org_id: str | None = None,
    project_id: str | None = None,
    env_id: str | None = None,
    password: str | None = None,
) -> TokenResponse

Parameters

phonestrrequired
codestrrequired
org_idstr | Noneoptionaldefault None
project_idstr | Noneoptionaldefault None
env_idstr | Noneoptionaldefault None
passwordstr | Noneoptionaldefault None

Returns

TokenResponse

#Ergonomic client

supabase-py's auth on the client: sovaria.auth.sign_in_with_password({...}), sign_up, get_user, update_user, on_auth_state_change, sessions (set_session, refresh_session), identities; sovaria.auth.mfa (factors: enroll, challenge, verify, assurance level) and sovaria.auth.admin (server code with an org owner/admin session: create, list, update, ban, invite and delete users, generate links). Calls return their value and raise SovariaError, like supabase-py.

`UserAuth`

sovaria.auth.get_session

The signed-in user's session, or None (the anon key alone is not a session).

sovaria.auth.get_session() -> AuthSession | None

Returns

AuthSession | None

sovaria.auth.on_auth_state_change

Call callback(event, session) on sign-in, token refresh, user update and sign-out.

sovaria.auth.on_auth_state_change(
    callback: Callable[[AuthChangeEvent, AuthSession | None], Any],
) -> Subscription

It is called once right away with INITIAL_SESSION.

Parameters

callbackCallable[[AuthChangeEvent, AuthSession | None], Any]required

Returns

Subscription

sovaria.auth.sign_in_with_password

{"email": ..., "password": ...} (options.captcha_token when CAPTCHA is on).

await sovaria.auth.sign_in_with_password(
    credentials: Mapping[str, Any],
) -> AuthResponse

Parameters

credentialsMapping[str, Any]required

Returns

AuthResponse

sovaria.auth.sign_up

Create an app user and sign them in: {"email", "password", "options": {"data": {...}}}.

await sovaria.auth.sign_up(
    credentials: Mapping[str, Any],
) -> AuthResponse

options.data is saved as user_metadata; with email confirmation on, session is None until the user confirms.

Parameters

credentialsMapping[str, Any]required

Returns

AuthResponse

  • 403 SIGNUP_DISABLED when new sign-ups are off.

sovaria.auth.sign_in_anonymously

A new anonymous user (turn it on in Authentication › Sign in / Providers); make it permanent later with update_user({"email": ..., "password": ...}).

await sovaria.auth.sign_in_anonymously(
    credentials: Mapping[str, Any] | None = None,
) -> AuthResponse

Parameters

credentialsMapping[str, Any] | Noneoptionaldefault None

Returns

AuthResponse

sovaria.auth.sign_in_with_oauth

The provider's sign-in URL ({"provider": "google", "options": {"redirect_to": ...}}) → .url.

await sovaria.auth.sign_in_with_oauth(
    credentials: Mapping[str, Any],
) -> AuthResponse

Open it in the user's browser; it returns to redirect_to with ?code=…&type=sso, which exchange_code_for_session(code) completes.

Parameters

credentialsMapping[str, Any]required

Returns

AuthResponse

sovaria.auth.sign_in_with_sso

SAML single sign-on for an app user, like supabase-py: {"domain": "acme.com"}, {"email": ...} or {"provider_id": <connection id>}, with options.redirect_to.

await sovaria.auth.sign_in_with_sso(
    credentials: Mapping[str, Any],
) -> AuthResponse

Returns .url (open it in the user's browser) and .code_verifier; the identity provider returns to redirect_to with ?code=…, and exchange_code_for_session(code) finishes on this client (or pass the verifier on another one). PKCE S256.

Parameters

credentialsMapping[str, Any]required

Returns

AuthResponse

sovaria.auth.exchange_code_for_session

Finish a provider sign-in with the code from the redirect (for sign_in_with_sso the verifier it made is used when none is given).

await sovaria.auth.exchange_code_for_session(
    code: str,
    code_verifier: str | None = None,
) -> AuthResponse

Parameters

codestrrequired
code_verifierstr | Noneoptionaldefault None

Returns

AuthResponse

sovaria.auth.sign_in_with_otp

{"email": ...} emails a sign-in link plus a 6-digit code; {"phone": ...} texts a code.

await sovaria.auth.sign_in_with_otp(
    credentials: Mapping[str, Any],
) -> AuthResponse

Finish with verify_otp.

Parameters

credentialsMapping[str, Any]required

Returns

AuthResponse

sovaria.auth.sign_in_with_id_token

Native "Sign in with Apple / Google": {"provider", "token", "nonce"?, "access_token"?} (the provider's ID token from the device) for a Sovaria session.

await sovaria.auth.sign_in_with_id_token(
    credentials: Mapping[str, Any],
) -> AuthResponse

Parameters

credentialsMapping[str, Any]required

Returns

AuthResponse

sovaria.auth.sign_in_with_third_party_token

Exchange a token from a trusted issuer (Firebase Auth, Auth0, Clerk, Cognito, WorkOS, OIDC) for a Sovaria session.

await sovaria.auth.sign_in_with_third_party_token(
    token: str,
) -> AuthResponse

Parameters

tokenstrrequired

Returns

AuthResponse

sovaria.auth.verify_otp

{"email", "token"} (the code from the sign-in email), {"phone", "token"} (an SMS code) or {"token_hash", "type"} from an email link.

await sovaria.auth.verify_otp(params: Mapping[str, Any]) -> AuthResponse

Parameters

paramsMapping[str, Any]required

Returns

AuthResponse

sovaria.auth.get_user

The signed-in user, read from the server (.user).

await sovaria.auth.get_user() -> AuthResponse

Raises SovariaError(401) when nobody is signed in.

Returns

AuthResponse

sovaria.auth.update_user

Change the signed-in user's data (user_metadata, merged), email (confirmed by a link first) or password (with current_password or a nonce).

await sovaria.auth.update_user(
    attributes: Mapping[str, Any],
) -> AuthResponse

An anonymous user who adds an email becomes permanent.

Parameters

attributesMapping[str, Any]required

Returns

AuthResponse

sovaria.auth.sign_out

Sign out and fall back to the anon key.

await sovaria.auth.sign_out(
    options: Mapping[str, Any] | None = None,
) -> None

{"scope": "local"} (default) revokes this session; "global" also signs out every other device; "others" signs out the other devices and keeps this one.

Parameters

optionsMapping[str, Any] | Noneoptionaldefault None

Returns

None

sovaria.auth.get_user_id

The signed-in user's id (the token's subject), or None for visitors.

sovaria.auth.get_user_id() -> str | None

Returns

str | None

sovaria.auth.set_session

Sign in with tokens you already have (from a browser, another process or a native app).

await sovaria.auth.set_session(
    access_token: str,
    refresh_token: str,
) -> AuthResponse

Parameters

access_tokenstrrequired
refresh_tokenstrrequired

Returns

AuthResponse

sovaria.auth.refresh_session

Refresh the session now (refresh_token replaces the stored one first).

await sovaria.auth.refresh_session(
    refresh_token: str | None = None,
) -> AuthResponse

Parameters

refresh_tokenstr | Noneoptionaldefault None

Returns

AuthResponse

sovaria.auth.reauthenticate

Send the signed-in user a one-time code; pass it as update_user({"password": ..., "nonce": code}).

await sovaria.auth.reauthenticate() -> None

Returns

None

sovaria.auth.reset_password_for_email

Email a password-reset link (options.redirect_to).

await sovaria.auth.reset_password_for_email(
    email: str,
    options: Mapping[str, Any] | None = None,
) -> None

Quiet for unknown addresses.

Parameters

emailstrrequired
optionsMapping[str, Any] | Noneoptionaldefault None

Returns

None

sovaria.auth.get_user_identities

The sign-in methods linked to the signed-in user (email, google, saml:…, passkey).

await sovaria.auth.get_user_identities() -> list[dict[str, Any]]

Returns

list[dict[str, Any]]

`AuthMFA`

sovaria.auth.mfa.enroll

{"factor_type": "totp" | "phone", "friendly_name"?, "phone"?} → the factor (TOTP: totp.qr_code, totp.secret, totp.uri).

await sovaria.auth.mfa.enroll(
    params: Mapping[str, Any],
) -> dict[str, Any]

Parameters

paramsMapping[str, Any]required

Returns

dict[str, Any]

sovaria.auth.mfa.challenge

Challenge.

await sovaria.auth.mfa.challenge(
    params: Mapping[str, Any],
) -> dict[str, Any]

Parameters

paramsMapping[str, Any]required

Returns

dict[str, Any]

sovaria.auth.mfa.verify

{"factor_id", "challenge_id", "code"}: the session becomes two-factor (aal2).

await sovaria.auth.mfa.verify(params: Mapping[str, Any]) -> Any

Parameters

paramsMapping[str, Any]required

Returns

Any

sovaria.auth.mfa.challenge_and_verify

Challenge and verify.

await sovaria.auth.mfa.challenge_and_verify(
    params: Mapping[str, Any],
) -> Any

Parameters

paramsMapping[str, Any]required

Returns

Any

sovaria.auth.mfa.unenroll

Unenroll.

await sovaria.auth.mfa.unenroll(
    params: Mapping[str, Any],
) -> dict[str, Any]

Parameters

paramsMapping[str, Any]required

Returns

dict[str, Any]

sovaria.auth.mfa.list_factors

List factors.

await sovaria.auth.mfa.list_factors() -> dict[str, Any]

Returns

dict[str, Any]

sovaria.auth.mfa.get_authenticator_assurance_level

Get authenticator assurance level.

await sovaria.auth.mfa.get_authenticator_assurance_level(
) -> dict[str, Any]

Returns

dict[str, Any]

`AuthAdmin`

sovaria.auth.admin.get_user_by_id

Get user by id.

await sovaria.auth.admin.get_user_by_id(
    uid: str,
) -> dict[str, Any] | None

Parameters

uidstrrequired

Returns

dict[str, Any] | None

sovaria.auth.admin.create_user

{"email", "password"?, "email_confirm"?, "user_metadata"?, "app_metadata"?, "roles"?, "temporary_password"?}. temporary_password: True: the server makes a strong password the user must change at first sign-in and returns it once, as the result's temporary_password (hand it to the person; don't log or store it).

await sovaria.auth.admin.create_user(
    attributes: Mapping[str, Any],
) -> dict[str, Any] | None

Parameters

attributesMapping[str, Any]required

Returns

dict[str, Any] | None

sovaria.auth.admin.list_users

One page of users, newest first (pages start at 1, at most 50 deep: use list_product_users_page and its cursor beyond that).

await sovaria.auth.admin.list_users(
    page: int = 1,
    per_page: int = 50,
) -> list[dict[str, Any]]

The list has .total and .next_page.

Parameters

pageintoptionaldefault 1
per_pageintoptionaldefault 50

Returns

list[dict[str, Any]]

sovaria.auth.admin.update_user_by_id

user_metadata / app_metadata / email_confirm / roles / ban_duration ("none" lifts a ban, anything else bans).

await sovaria.auth.admin.update_user_by_id(
    uid: str,
    attributes: Mapping[str, Any],
) -> dict[str, Any] | None

Email, password and phone are the user's own to change.

Parameters

uidstrrequired
attributesMapping[str, Any]required

Returns

dict[str, Any] | None

sovaria.auth.admin.delete_user

Delete user.

await sovaria.auth.admin.delete_user(uid: str) -> None

Parameters

uidstrrequired

Returns

None

sovaria.auth.admin.invite_user_by_email

Create a passwordless user and email them a sign-in link.

await sovaria.auth.admin.invite_user_by_email(
    email: str,
    options: Mapping[str, Any] | None = None,
) -> dict[str, Any] | None

options.data becomes their user_metadata.

Parameters

emailstrrequired
optionsMapping[str, Any] | Noneoptionaldefault None

Returns

dict[str, Any] | None

`AppOrganizations`

sovaria.auth.organizations.list

List.

await sovaria.auth.organizations.list() -> dict[str, Any]

Returns

dict[str, Any]

sovaria.auth.organizations.get

Get.

await sovaria.auth.organizations.get(org_id: str) -> dict[str, Any]

Parameters

org_idstrrequired

Returns

dict[str, Any]

sovaria.auth.organizations.create

Create.

await sovaria.auth.organizations.create(
    name: str,
    *, slug: str | None = None,
) -> dict[str, Any]

Parameters

namestrrequired
slugstr | Noneoptionaldefault None

Returns

dict[str, Any]

sovaria.auth.organizations.update

Update.

await sovaria.auth.organizations.update(
    org_id: str,
    *, name: str | None = None,
    metadata: Mapping[str, Any] | None = None,
) -> dict[str, Any]

Parameters

org_idstrrequired
namestr | Noneoptionaldefault None
metadataMapping[str, Any] | Noneoptionaldefault None

Returns

dict[str, Any]

sovaria.auth.organizations.delete

Delete.

await sovaria.auth.organizations.delete(org_id: str) -> None

Parameters

org_idstrrequired

Returns

None

sovaria.auth.organizations.set_active

Set active.

await sovaria.auth.organizations.set_active(
    org_id: str | None,
) -> dict[str, Any]

Parameters

org_idstr | Nonerequired

Returns

dict[str, Any]

sovaria.auth.organizations.invite

Invite.

await sovaria.auth.organizations.invite(
    org_id: str,
    email: str,
    role: str = 'member',
    *, redirect_to: str | None = None,
) -> dict[str, Any]

Parameters

org_idstrrequired
emailstrrequired
rolestroptionaldefault 'member'
redirect_tostr | Noneoptionaldefault None

Returns

dict[str, Any]

sovaria.auth.organizations.revoke_invite

Revoke invite.

await sovaria.auth.organizations.revoke_invite(
    org_id: str,
    invite_id: str,
) -> None

Parameters

org_idstrrequired
invite_idstrrequired

Returns

None

sovaria.auth.organizations.accept_invite

Accept invite.

await sovaria.auth.organizations.accept_invite(
    token: str,
) -> dict[str, Any]

Parameters

tokenstrrequired

Returns

dict[str, Any]

sovaria.auth.organizations.set_member_role

Set member role.

await sovaria.auth.organizations.set_member_role(
    org_id: str,
    user_id: str,
    role: str,
) -> dict[str, Any]

Parameters

org_idstrrequired
user_idstrrequired
rolestrrequired

Returns

dict[str, Any]

sovaria.auth.organizations.remove_member

Remove member.

await sovaria.auth.organizations.remove_member(
    org_id: str,
    user_id: str,
) -> None

Parameters

org_idstrrequired
user_idstrrequired

Returns

None

sovaria.auth.organizations.add_domain

Add domain.

await sovaria.auth.organizations.add_domain(
    org_id: str,
    domain: str,
) -> dict[str, Any]

Parameters

org_idstrrequired
domainstrrequired

Returns

dict[str, Any]

sovaria.auth.organizations.verify_domain

Verify domain.

await sovaria.auth.organizations.verify_domain(
    org_id: str,
    domain: str,
) -> dict[str, Any]

Parameters

org_idstrrequired
domainstrrequired

Returns

dict[str, Any]