Components for authenticating against the Commure Platform using the OpenID Connect and SMART App Launch protocols.

The SMARTClient class implements the client side of the SMART protocol. It handles the work of interfacing with the Commure Authentication API for you. To initialize SMARTClient, pass it an object with the following keys.

clientIdstringThe client ID provided by Commure. For testing with the developer sandbox, you can use smart_hello_world.
scopesstring[]The set of scopes to request. Typically apps will require the openid, profile, email, and fhirUser scopes.
redirectUristringThe redirect URL configured with Commure. For smart_hello_world this is http://localhost:1234/callback.
standaloneLaunchstringWhether the app should be launched as standalone; valid values are always, ifNecessary, and never. An app launched as standalone doesn't receive launch context during the SMART flow.
fhirBaseUrlstring(optional) The FHIR server used if we aren't given this information by EHR's launch context doesn't provide it to us. Required in order to use standalone launch. For the sandbox this is https://api-<tenant>

The CommureSmartApp React component integrates with SMARTClient to seamlessly authenticate users before the app starts running. Developers often don't need to use SMARTClient directly beyond initializing and passing it to CommureSmartApp. Simply wrap your app with CommureSmartApp and the component will ensure the user is authenticated. You can then use the

components to interface with the FHIR API.



1import React from "react";
2import { CommureSmartApp } from "@commure/components-data";
3import SMARTClient, { StandalonePreference } from "@commure/smart-core";
5const smartClient = new SMARTClient({
6 clientId: "smart_hello_world", // this client_id will work with your Commure tenant
7 scopes: ["openid", "profile", "fhirUser"],
8 redirectUri: "http://localhost:1234/callback", // the app's callback url
9 standaloneLaunch: StandalonePreference.IfNecessary,
10 fhirBaseUrl: ""
13export default () => (
14 <CommureSmartApp client={smartClient}>
15 <div>Hello World!</div>
16 </CommureSmartApp>

API Reference


Prop NameRequired?TypeDescription
childrentrueReact.ReactNodeChild components to be rendered.
clienttrueSMARTClientSMARTClient instance for the application.

Related Reading

Build a New Application