SMART App Launch
Patient apps (MySoma sign-in) and provider apps opened from Soma: authorization code with PKCE, refresh tokens and OpenID Connect.
Apps that act for a patient or for a provider sign in with SMART App Launch 2.0. Server-to-server apps keep using SMART Backend Services.
Kinds of apps
| App type | How it starts | Scopes | fhirUser |
|---|---|---|---|
| Patient app | Standalone launch: your app sends the patient to /auth/authorize; they sign in to MySoma (with a one-time code) and choose what to share. | patient/*.rs, patient/Condition.rs?category=…, v1 patient/*.read | Patient/{id} |
| Provider app | EHR launch: a provider opens your app from a patient's chart in Soma; Soma opens your launch URL with iss and launch. | user/*.rs, patient/*.rs, launch | Practitioner/{id} |
The practice registers your app in Settings › Integrations › FHIR API with its type, redirect URLs (exact match), launch URL (provider apps), the resources it may read and how it signs in at the token endpoint: a client secret (client_secret_basic or client_secret_post; shown to the practice once), private_key_jwt (your public JWKS), or none for public apps (PKCE only).
Endpoints
/.well-known/smart-configurationEndpoints, capabilities and scopes (no sign-in)./.well-known/openid-configurationOpenID Connect discovery; the issuer is the FHIR base URL./.well-known/jwks.jsonThe practice's public key for id_token signatures (RS256)./auth/authorizeAuthorization request (POST with a form works too)./auth/tokenauthorization_code and refresh_token grants./auth/introspectToken introspection (RFC 7662)./auth/revokeToken revocation (RFC 7009).Authorization request
https://qa3.somahealth.com/api/fhir/r4/{practice}/auth/authorize?response_type=code&client_id={client_id}
&redirect_uri={registered redirect}&scope=launch/patient openid fhirUser offline_access patient/*.rs
&state={random}&aud={FHIR base URL}&code_challenge={S256 challenge}&code_challenge_method=S256audmust be the practice's FHIR base URL, andredirect_urione the practice registered; otherwise the patient sees an error page and isn't sent back.- PKCE is required, with
S256only.stateis required. - Provider apps add the
launchvalue Soma gave them; it works once, within 5 minutes. - The patient may uncheck scopes. The token response's
scopelists what was granted, which can be less than you asked for.
Token response
{
"access_token": "fhr_…",
"token_type": "Bearer",
"expires_in": 3600,
"scope": "launch/patient openid fhirUser offline_access patient/Patient.rs patient/Condition.rs",
"refresh_token": "fhrr_…",
"id_token": "eyJ…",
"patient": "{Patient id}",
"need_patient_banner": true
}- Access tokens last 1 hour. Refresh tokens:
offline_access92 days,online_access24 hours. A refresh returns a new access token and the same refresh token; it may narrowscope, never widen it. - Provider launches add
encounterwhen the provider opened the app from a visit. - Patient-context tokens see only that patient's record: searches default to the patient, and other patients aren't found.
- The id_token is signed RS256 (
kidin the JWKS);issis the FHIR base URL,audyour client_id, and it carriesfhirUser.
Ending access
Patients see the apps they connected in MySoma › Connected apps and can turn one off; the practice can pause or remove an app. Either takes effect right away: the next request with the app's tokens gets a 401, and its refresh token stops working. Apps can end their own tokens with /auth/revoke.
Clinical summary ($docref)
/DocumentReference/$docref?patient={id}The patient's Continuity of Care Document (C-CDA R2.1), made on request.Returns a Bundle with one DocumentReference (LOINC 34133-9) whose attachment holds the CCD as base64 application/xml. Patient apps may leave out patient.