Skip to main content

Step 2: Create and configure the Ovok project

What we are building​

A sandbox project that can register and authenticate patients and accept measurement writes from the app. This step is done in Ovok Console; the app receives only the sandbox API URL and public tenant code.

What you should already have​

  • The native Expo project from step 1.
  • Access to the Ovok Console and permission to create or configure a project.

The implementation​

Configure in Ovok Console​

  1. Create a project for the sandbox app, or select an existing sandbox project.
  2. Record the project's tenant code for the app. The code must belong to the sandbox environment used in this guide.
  3. Enable patient sign-in by ensuring PATIENT_LOGIN_ENABLED is not set to false. See Patient login.
  4. Set PATIENT_REGISTRATION_ENABLED to true if patients will create accounts from the app. Registration also requires a project default Patient AccessPolicy. See Patient registration and project setup.
  5. Set a least-privilege default Patient AccessPolicy for newly registered accounts. It must grant only the resource and operation access this app needs, including the approved Patient profile and Observation workflows. Follow Access policies; do not paste a permissive example policy into a real project.
  6. Confirm that the transaction-bundles feature is enabled. It is enabled for new projects by default, but older projects may not have it. The feature makes supported multi-resource writes atomic. See Transaction bundles.
  7. Decide whether the project should send a patient welcome email. If so, map the PATIENT_WELCOME template and complete the email provider setup. This is optional for the tutorial's email/password flow; see the template catalogue and email setup.
  8. Enable Ovok CMS for the project. The tutorial stores app translations in the CMS translations collection; publish them to the sandbox's staging environment. The collection is open by default, so the mobile app reads published translations using its tenant code without an API key. See Enable the CMS and Use Ovok CMS with i18n.

Do not enable practitioner registration or invitations for this patient-only tutorial unless your product needs them.

Configure in the app​

Put the sandbox values in your local environment file:

EXPO_PUBLIC_OVOK_BASE_URL=https://api.sandbox.ovok.com
EXPO_PUBLIC_TENANT_CODE=the-tenant-code-from-your-sandbox-project

Create src/config/ovok.ts:

const baseUrl =
process.env.EXPO_PUBLIC_OVOK_BASE_URL ?? "https://api.sandbox.ovok.com";
const tenantCode = process.env.EXPO_PUBLIC_TENANT_CODE;

if (!tenantCode) {
throw new Error("Set EXPO_PUBLIC_TENANT_CODE to the sandbox project code.");
}

export const ovokConfig = { baseUrl, tenantCode };

The React Native app will use these values when it creates one OvokClient in step 5. The app config does not contain patient passwords or credentials.

Important Ovok decisions​

  • Patient registration creates the account and Patient profile through the supported authentication flow. Do not create a second Patient resource after signup.
  • The default AccessPolicy is project configuration, not an app-side permission check. It controls what the authenticated Patient can access.
  • Atomic transactions depend on the project feature. A successful measurement write should be treated as complete only after the SDK confirms the save.
  • A Patient app URL is only needed when a project sends links that should open the app. This tutorial does not use password-reset, invitation, or social-login links, so it does not invent a redirect or deep-link setting.

Expected result​

The project can accept sandbox patient registration and sign-in, has the intended Patient AccessPolicy, has transaction bundles enabled, and has CMS available for published translations. The app has a sandbox URL and tenant code in local configuration.

Common errors and troubleshooting​

  • Registration is refused: confirm patient registration is enabled, the tenant code belongs to this project, and a default Patient AccessPolicy exists.
  • Login is refused: confirm the account belongs to this tenant and patient login is enabled.
  • Writes are not atomic: check the project feature list for transaction-bundles.
  • The app cannot load its text: confirm CMS is enabled and the translation groups are published in the sandbox staging environment for this tenant.
  • Welcome email is absent: this is expected until the template is mapped and the provider is ready.
  • The app points at the wrong environment: confirm the API URL and tenant code are both from the sandbox project.

Next step​

Continue to step 3: configure localisation.