Registration
Use register() to create a patient account in a tenant. A successful registration returns an authenticated result, so the patient can continue without a separate sign-in call.
register() does not create practitioner accounts. Practitioner registration and invitations are configured separately; see Ovok's practitioner registration guide.
Patient registration details
The registration request requires:
| Field | Purpose |
|---|---|
email | Patient's email address. |
password | Password to set for the account. |
passwordConfirm | Confirmation value. The SDK checks that it matches password before submitting the request. |
name | Patient's given name. |
surname | Patient's family name. |
tenantCode | Tenant where the patient account will be created. |
The SDK does not define the application's password rules or registration screen. Validate the form in the application and present errors in a way the user can act on.
Prepare the project
Patient registration depends on project configuration. Before adding the form, confirm that:
- Patient registration is enabled in the target project. See PATIENT_REGISTRATION_ENABLED.
- The project has a default patient AccessPolicy for new accounts. See project setup and AccessPolicies.
- The tenant code belongs to the selected environment and project.
The patient registration guide describes the platform's prerequisites and response behavior.
Handle the result
On the standard patient registration path, register() returns the same authenticated result shape as a completed sign-in: tokens, expiry, patient profile, and project. Continue into the signed-in experience only when the response represents that completed path.
Some project configurations can route a business email into a practitioner invitation flow. In that case, the platform can return an invitation next step instead of tokens. If this behavior is enabled for your project, handle that outcome explicitly; see business-email sign-up.
Example
The example assumes client is configured and the values have passed the application's form validation.
async function registerPatient() {
const authenticated = await client.register({
email,
password,
passwordConfirm,
name,
surname,
tenantCode,
});
onSignedIn(authenticated);
}
Invitations and practitioner accounts
For an existing practitioner, use the configured invitation flow instead of attempting to create a duplicate account. The platform's practitioner registration guide explains when self-registration is available, and the practitioner invitation setting covers invitation configuration.
For registration errors, first confirm the tenant, registration setting, and default AccessPolicy. Then review authentication troubleshooting.