TouAI

Auth

The Auth namespace covers registration, login, password recovery, profile management, context switching, and OAuth provider discovery.

Registration and Login

response = client.auth.register(
    "user@example.com",
    "SecurePassword123!",
    full_name="Jane Doe",
)
 
tokens = client.auth.verify_email("user@example.com", "123456")
client.auth.resend_verification("user@example.com")
 
tokens = client.auth.login("user@example.com", "SecurePassword123!")
tokens = client.auth.refresh()
client.auth.logout()

Password Recovery

client.auth.forgot_password("user@example.com")
client.auth.reset_password("user@example.com", "123456", "NewPassword!")
 
hints = client.auth.forgot_email(
    full_name="Jane Doe",
    partial_email="jane@",
)
print(hints.email_hints)

User Profile and Workspace

user = client.auth.me()
print(user.email, user.full_name)
 
client.auth.update_profile(full_name="Jane Smith")
client.auth.delete_account()
 
workspace = client.auth.workspace()

Context Switching and OAuth

tokens = client.auth.switch_context(organization_id="org-uuid")
tokens = client.auth.switch_context(organization_id=None)
 
providers = client.auth.oauth.providers()
url = client.auth.oauth.authorize_url(
    "google",
    frontend_redirect="https://app.tou.ai/auth/callback",
)
OrganizationsError Handling
Auth | Documentation