Blog

    Cerner EHR React Native Developer Guide: Oracle Health FHIR, PKCE and Token Storage

    By GauravJune 28, 20269 mins read
    On this page

    React Native lets one team ship an iOS and Android app from a shared codebase, which suits healthcare products with small mobile teams. Connecting that app to Oracle Health (Cerner) adds work the framework does not do for you: registration, a secure sign-in flow, careful token handling and testing against real sandboxes.

    This guide is for mobile developers and technical leads building patient or clinician apps on Oracle Health Millennium FHIR APIs. It walks through registration, the standalone launch with PKCE, where tokens should live on the phone, refresh, offline data and testing.

    How do you build a React Native app on Oracle Health (Cerner) FHIR APIs?

    Building an app on top of an EHR?

    See how we design and build EHR software and the integrations it depends on.

    A React Native app on Oracle Health (Cerner) FHIR APIs is a mobile app that is registered with Oracle Health, signs users in through a standalone SMART launch with PKCE in an in-app browser, keeps tokens in secure device storage and calls Millennium FHIR R4 endpoints. Agnotic Technologies builds these apps for patients and clinicians.

    Most of the hard work sits in the sign-in and token layer. Get that right once, in shared code, and the screens that read FHIR data become ordinary React Native work.

    What does Oracle Health expose to a mobile app?

    Oracle Health exposes Millennium data through FHIR R4 APIs secured with OAuth 2.0, and each interaction states which kinds of users may call it. Check those details per resource before designing a screen.

    Oracle Health documents its Millennium Platform FHIR R4 (4.0.1) APIs with an OAuth 2.0 secured endpoint that supports SMART applications, and each resource interaction states whether patient, provider or system authentication is accepted.

    • Patient access: the user is the patient, and the token limits data to that patient's record.
    • Provider access: the user is a clinician, and the organization's rules decide what they may see.
    • System access: a backend service with no user, which a phone app should never hold.

    Decide early whether the app is for patients or clinicians. The registration, scopes and review process differ, and mixing both audiences in one app makes each harder.

    How do you register the app in code Console?

    You register the app in Oracle Health's code Console, choosing an application type and privacy setting that match a mobile app. A phone app cannot keep a secret, so it registers as a public client.

    Oracle Health requires a client application to be registered, using a free CernerCare account, before it can use protected resources; registration issues a client ID, and Oracle Health customers may then enable the application to access their protected resources.

    • Application type: patient or provider, matching who signs in.
    • Privacy: public, because any secret shipped inside an app package can be extracted.
    • Redirect URI: the address the authorization server returns to, which the app must claim on both platforms.
    • Scopes: only the resources and actions the first release needs.

    Registration gives you a client ID, not access to any hospital's data. Each Oracle Health customer still decides whether to enable your app.

    Standalone launch from a phone

    A mobile app normally uses a standalone launch: the user opens your app, which sends them to Oracle Health to sign in and returns with a code. The flow runs in an in-app browser session, which Oracle Health's guide recommends for native apps.

    Standalone SMART launch for a React Native app on Oracle Health: the app creates a PKCE verifier and challenge, the user signs in and approves scopes in an in-app browser, the Oracle Health authorization server returns a code that is exchanged with the verifier for a token, and the app calls Millennium FHIR R4 APIs, with a device storage lane

    SMART App Launch 2.x states that all SMART apps shall support PKCE, and that servers shall support the S256 code challenge method and shall not support the plain method.

    • Step 1, prepare: read the authorization and token endpoints for the chosen environment from configuration.
    • Step 2, challenge: create a random code verifier and its S256 challenge on the device.
    • Step 3, sign in: open the in-app browser with the client ID, scopes, redirect URI, state and challenge.
    • Step 4, exchange: receive the code at the redirect URI, check the state and swap the code and verifier for tokens.

    Use a maintained OAuth library built on the platform browser sessions rather than writing the flow by hand. Confirm in Oracle Health's documentation and sandbox how your target environment handles PKCE before release.

    Where should tokens live on the device?

    Tokens should live in the platform's secure storage: the iOS Keychain and Android Keystore-backed encrypted storage. Plain app storage, such as general key-value storage, is readable on a compromised or backed-up device.

    • Access token: kept in memory where possible and written to secure storage only if the app must survive restarts.
    • Refresh token: always in secure storage, with access tied to the device lock where the platform allows.
    • Logs: never print tokens, codes or patient data, including in crash reports and debug builds.
    • Sign-out: delete every stored token and cached record, not just the visible session.

    How should the app handle token expiry and refresh?

    The app should treat short access token lifetimes as normal and refresh quietly when a token expires. Oracle Health documents a short default access token life and supports refresh tokens for longer use.

    Put refresh logic in one place, such as an API client wrapper, so every screen benefits. When refresh fails, send the user back through sign-in with a clear message instead of showing empty screens.

    • Online access: refresh works only while the user is actively using the app.
    • Offline access: refresh continues after the app closes, which suits patient apps but needs stronger device protection.
    • Revocation: handle a revoked token gracefully, because users and administrators can withdraw access.

    Handling patient data offline

    Offline data should be limited to what the user needs when the network drops, stored encrypted and removed on sign-out. Every cached record is health data on a device you do not control.

    • Cache narrowly: the last medication list or upcoming appointments, not the full record.
    • Show freshness: display when data was last updated so users do not act on stale results.
    • Expire: clear cached records after a period your privacy review agrees.

    Phone backups can copy app data off the device. Exclude cached health data from backups where the platform allows, and test that a restored phone does not bring old records back.

    Failure points in React Native EHR apps

    React Native EHR apps fail most often at the seams between JavaScript, native modules and the authorization server. These failures are worth testing for on purpose.

    • Redirect not claimed: the app does not register its redirect URI correctly on one platform, so sign-in never returns.
    • Tokens in plain storage: a quick prototype ships with tokens in general storage.
    • Hard-coded endpoints: sandbox URLs left in a production build.
    • Silent refresh loops: a failed refresh retries forever and drains the battery.
    • Missing resource checks: a screen assumes data every site exposes, and shows errors at the first customer.

    Each one is easy to miss in a demo and costly after release. A short pre-release checklist catches most of them.

    A worked example: a patient medication app

    A worked example: a specialty pharmacy wants a patient app that shows current medications and upcoming refills from a partner health system on Oracle Health. The team registers a patient app in code Console with read scopes for medications and the patient record.

    Sign-in runs as a standalone launch with PKCE through a maintained OAuth library. Tokens go into the Keychain and Keystore, and the app caches only the medication list, marked with the time it was fetched.

    Testing in the sandbox finds that one test patient has no medication data, so the empty state gets a clear message. The health system then reviews and enables the app for its patients.

    Who owns each part of an Oracle Health mobile app?

    A mobile EHR app spans your team, the health system and Oracle Health. Clear ownership keeps each go-live from stalling.

    • Mobile team: sign-in flow, token storage, caching, screens and app store releases.
    • Backend team: any services the app calls besides Oracle Health, and their own security.
    • Health system: enabling the app, choosing scopes it allows and supporting its patients or staff.
    • Security reviewer: storage, logging and the sign-out and revocation tests.

    How do you test against Oracle Health sandboxes?

    Test against Oracle Health's sandbox environments with test patients first, then with a customer's non-production environment before go-live. Each step catches different problems.

    • Sign-in tests: success, cancel, wrong state value and a revoked token.
    • Data tests: every screen with full, partial and empty data for its resources.
    • Platform tests: iOS and Android release builds, not only debug builds or simulators.
    • Security tests: no tokens in logs or plain storage, and a clean device after sign-out.

    Automate the data and sign-out tests where you can. Sign-in tests usually need a person, so script them as a short manual checklist for every release.

    What are React Native Oracle Health app best practices?

    Register as a public client with only the scopes you need, run sign-in in an in-app browser with PKCE, and keep tokens in the Keychain or Keystore. Centralize refresh and handle revocation calmly.

    Cache little, show data freshness, keep endpoints in configuration per environment, and test release builds on both platforms against real sandboxes.

    How can Agnotic help build a React Native EHR app?

    Agnotic builds React Native apps for patients and clinicians on Oracle Health and other EHRs: code Console registration, standalone launch, secure token storage, offline rules and the tests that prove them. We also support health system reviews before an app is enabled.

    Connect your app to Oracle Health

    We build apps and integrations on Oracle Health (Cerner) FHIR APIs and interfaces.

    Sources

    Frequently Asked Questions

    Yes. A React Native app can register with Oracle Health, sign users in through a SMART standalone launch and call Millennium FHIR R4 APIs.

    Talk to an engineer about your project

    Tell us who will use your app and which Oracle Health data it needs. We will outline registration, sign-in and storage for both platforms.