FHIR DrillDocs

Security

SMART on FHIR

What SMART adds, how its flows work and how you could add it to the lab.

SMART on FHIR is the standard way for apps to get permission to use a FHIR API. It's OAuth 2.0 plus OpenID Connect, with FHIR-specific scopes and launch context. It's what real clinical apps, patient apps and backend integrations use.

The three flows#

Flow Who Grant
EHR launch An app opened inside a clinical system, which already knows the current patient Authorization code + launch parameter
Standalone launch An app opened on its own, where the user picks a patient Authorization code + launch/patient scope
Backend services A server-to-server integration with no user Client credentials with a signed JWT (private_key_jwt)

Scopes (SMART v2)#

Text
patient/Observation.rs          read + search Observations for the patient in context
user/Patient.cruds              full access to Patients the user can see
system/*.rs                     backend: read + search everything
launch/patient openid fhirUser  ask for patient context and the user's identity

The letters are create, read, update, delete and search.

Discovery#

A SMART server publishes its endpoints at [base]/.well-known/smart-configuration: the authorisation and token URLs, the supported scopes and its capabilities. HAPI in this lab has no SMART, so that URL returns 404.

Try it now

The lab has a working SMART authorisation server in OpenEMR, and a teaching app. See OpenEMR and SMART on FHIR.

Adding SMART to HAPI (stage 5)#

  1. An authorisation server: Keycloak is the usual open-source choice, as a new compose stack.
  2. Token checking in front of HAPI: either HAPI's interceptor framework (an AuthorizationInterceptor that reads the JWT's scopes) or a gateway that validates tokens before passing requests on.
  3. Test it with the SMART App Launcher (launch.smarthealthit.org) for app flows, and Inferno's SMART tests for conformance.

This is the biggest project in the drills, so plan a weekend for it.

FHIR Drill lab docs · synthetic data only · built 2026-11-26