Authentication
ovok.auth signs users in and out, registers patients and practitioners, and manages the
- Stable unknown
- Release candidate since 0.1.0-rc.3
- Development since 0.1.0-dev.21+c43ebba
ovok.auth signs users in and out, registers patients and practitioners, and manages the
signed-in account. Use it on a client built without client_secret; a machine client
authenticates on its own (see Get started).
Sign a user in
login returns SignedIn, or MfaRequired when the account needs a one-time code. The
client stores the session and refreshes it before it expires.
from ovok_sdk import Ovok
ovok = Ovok("https://api.sandbox.ovok.com", "your-tenant")
result = ovok.auth.login(profile_type="Patient", email=email, password=password)
if result.status == "mfa-required":
result = ovok.auth.verify_mfa(result.challenge, code)
print(result.session.profile.reference)For Apple or Google sign-in, pass the provider's result to social_login; this needs
client_id in the client config.
Register an account
register signs a new patient in, unless the project routes the email to a clinician
invitation. The password confirmation is checked locally and never sent.
from ovok_sdk import PatientRegistration
result = ovok.auth.register(
PatientRegistration(
email="ada@example.com",
password=password,
password_confirm=password,
name="Ada",
surname="Lovelace",
)
)
if result.status == "clinician-invite":
print("Check your email for the clinician invitation.")Use register_practitioner with a Registration for practitioners.
Manage passwords and sessions
ovok.auth.change_password(old_password=old, new_password=new)
ovok.auth.reset_password(email="ada@example.com", profile_type="Patient")
for session in ovok.auth.sessions.list():
print(session)
ovok.auth.sessions.revoke("other")logout ends the session on the server and always clears it locally.
API reference
See ovok_sdk.resources.auth,
ovok_sdk.resources.auth_sessions
and ovok_sdk.resources.registration
for every method, parameter and error.
Last updated on