This page shows a practical way to use Google’s Open Health Stack (OHS) example apps to connect to an existing SMART‑on‑FHIR server. It uses the OHS FHIR App Examples demo/ app together with the FHIR Info Gateway as a reverse proxy in front of your FHIR base URL.
References are included inline for each step.
Why this example?
-
OHS FHIR App Examples (
demo/) demonstrate wiring the Android FHIR SDK to a FHIR backend via FHIR Info Gateway—the easiest path to “attach” OHS to your current server and layer access control.
Source: Google Developers “Example apps and code samples” and thegoogle/fhir-app-examplesrepo.
developers.google.com/open-health-stack/resources/examples • github.com/google/fhir-app-examples -
FHIR Info Gateway explicitly supports integration with SMART‑on‑FHIR applications when deployed as a stand‑alone proxy in front of any app/FHIR server.
Source: OHS use‑cases page (SMART integration note).
developers.google.com/open-health-stack/use-cases -
For SMART discovery/endpoints and scopes, use the SMART App Launch and Google Cloud Healthcare SMART docs as normative references.
build.fhir.org/ig/HL7/smart-app-launch/app-launch.html • cloud.google.com/healthcare-api/docs/smart-on-fhir
Architecture at a Glance
Android FHIR SDK (demo app)
|
v
FHIR Info Gateway ---> Existing SMART-on-FHIR Authorization Server
|
v
Your FHIR Server (SMART-enabled)
- The Gateway forwards FHIR requests to your SMART FHIR base and can enforce privacy/access controls; the client discovers SMART config from the server’s
/.well-known/smart-configuration.
Source: OHS use‑cases (Gateway with SMART) • SMART App Launch spec.
developers.google.com/open-health-stack/use-cases • build.fhir.org/ig/HL7/smart-app-launch/app-launch.html
Prerequisites
- An existing SMART‑on‑FHIR server (R4 recommended) exposing:
/.well-known/smart-configurationauthorization_endpointandtoken_endpoint-
Clinical scopes you intend to grant (e.g.,
patient/*.read,openid,fhirUser,launch)
Source: SMART App Launch and Cloud Healthcare SMART guide.
build.fhir.org/ig/HL7/smart-app-launch/app-launch.html • cloud.google.com/healthcare-api/docs/smart-on-fhir -
Android build toolchain, plus the OHS demo app source.
Source: OHS examples index andfhir-app-examplesrepo.
developers.google.com/open-health-stack/resources/examples • github.com/google/fhir-app-examples
Step‑by‑Step
1) Clone and build the OHS demo app
git clone https://github.com/google/fhir-app-examples.git
cd fhir-app-examples/demo
# Open in Android Studio; build & run on an emulator/device
- This demo integrates Android FHIR SDK with FHIR Info Gateway and shows registration/questionnaire flows.
Source:fhir-app-examplesREADME and OHS Android FHIR SDK docs.
github.com/google/fhir-app-examples • developers.google.com/open-health-stack/android-fhir
2) Deploy/configure FHIR Info Gateway
You can deploy the Gateway alongside your server and set it to forward to your SMART FHIR base URL.
Minimal conceptual config (pseudo‑YAML):
gateway:
target_fhir_base: "https://your-smart-fhir.example.com/fhir" # your existing FHIR base (iss)
auth:
# integrate with your SMART authorization server
smart:
discovery: "https://your-smart-fhir.example.com/.well-known/smart-configuration"
required_scopes:
- "openid"
- "fhirUser"
- "launch"
- "patient/*.read"
# optional: add policy to restrict compartments or worker access
cors:
allowed_origins:
- "https://your-android-app-origin-or-debug"
- As a proxy, the Gateway can be placed in front of any app and supports SMART apps; use it to enforce organizational policies on access to FHIR resources.
Source: OHS use‑cases (Gateway + SMART).
developers.google.com/open-health-stack/use-cases
3) Point the demo app at the Gateway
In the demo app configuration (e.g., buildConfig/settings or an environment file used by the app), set:
- The demo’s synchronization and reads will go through the Gateway to your SMART FHIR server.
Source:fhir-app-examplesdemo description.
github.com/google/fhir-app-examples
4) Ensure SMART discovery & flows work
-
Your server must expose
/.well-known/smart-configurationwith OAuth endpoints; clients discover these at runtime.
Source: SMART App Launch spec.
build.fhir.org/ig/HL7/smart-app-launch/app-launch.html -
Common SMART scopes for a patient‑context app:
openid fhirUser launch patient/*.read(extend with.writeor resource‑specific scopes as appropriate).
Source: Cloud Healthcare SMART overview and SMART scope docs.
cloud.google.com/healthcare-api/docs/smart-on-fhir • build.fhir.org/ig/HL7/smart-app-launch/app-launch.html
5) Register your client with the authorization server
- Register the app to obtain a client_id (and decide on PKCE vs. confidential client).
- Configure redirect_uri used by the app’s OAuth flow.
Source: SMART App Launch registration and launch steps.
build.fhir.org/ig/HL7/smart-app-launch/app-launch.html#top-level-steps • cloud.google.com/healthcare-api/docs/smart-on-fhir#configure-your-authorization-server-for-smart-on-fhir
Testing Tips
-
Check SMART discovery:
You should seeauthorization_endpoint,token_endpoint,scopes_supported, etc.
Source: SMART App Launch discovery.
build.fhir.org/ig/HL7/smart-app-launch/app-launch.html#retrieve-well-known-smart-configuration -
Dry‑run with SMART Health IT tools before mobile integration (optional):
Use the SMART App Launcher or sample browser apps to validate scopes and redirects.
Source: SMART Health IT documentation.
docs.smarthealthit.org
Notes & Considerations
-
The Android FHIR Engine Demo App (separate from
fhir-app-examples) defaults to a public HAPI server for sync; it’s useful for offline/sync patterns, but it is not a SMART launch sample by itself—prefer thedemoapp + Gateway for SMART scenarios.
Source: OHS examples page.
developers.google.com/open-health-stack/resources/examples -
If you need a web client reference (instead of Android), see a modern React EHR‑launch sample that implements PKCE and the SMART EHR launch flow.
Source: Provider EHR Launch sample (React).
github.com/cfu288/smart-provider-ehr-launch-app
Reference Links (curated)
-
Open Health Stack: Overview & Use Cases
developers.google.com/open-health-stack •
developers.google.com/open-health-stack/use-cases -
Example Apps
developers.google.com/open-health-stack/resources/examples •
github.com/google/fhir-app-examples -
Android FHIR SDK
developers.google.com/open-health-stack/android-fhir -
SMART‑on‑FHIR
SMART App Launch (HL7):
build.fhir.org/ig/HL7/smart-app-launch/app-launch.html
Google Cloud Healthcare SMART guide:
cloud.google.com/healthcare-api/docs/smart-on-fhir
SMART Health IT docs & tools:
docs.smarthealthit.org
What to share for a tailored config
If you want me to produce exact config snippets:
- Your FHIR base (
iss) and whether you want EHR Launch or Standalone Launch. - The scopes you plan to grant (e.g.,
patient/*.read,user/*.read,launch,openid,fhirUser). - Whether your client is public (PKCE) or confidential.
I’ll then provide a ready‑to‑paste gateway config and the app‑side settings (audience aud, redirect_uri, and launch handling) based on your server.