appContext

185 views
Skip to first unread message

Michael G

unread,
Aug 24, 2018, 10:57:31 AM8/24/18
to CDS Hooks
I have a question regarding the appContext passed in the link array of a card. According to the CDS Hooks specification documentation,  "The appContext field and value will be sent to the SMART app as part of the OAuth 2.0 access token response, alongside the other SMART launch parameters when the SMART app is launched." However, when trying to pass even a simple string in the appContext, nothing comes through as part of the session token response in the SMART app. The link type is 'smart', in accordance with the documentation.

For example, the expected behavior is as follows. The card sent is something like this
cards: [
{
summary: 'summary goes here',
indicator: 'info',
detail: 'detail goes here',
source: {
label: 'some label here',
url: 'some url here',
icon: 'some icon here'
},
links: [
{
label: 'some label here',
type: 'smart',
appContext: 'foo'
}
]
}
]
So when I click the url to launch the SMART app and inspect the request session tokenResponse object, I would expect to see something like this:

tokenResponse: { need_patient_banner: true, smart_style_url: 'https://launch.smarthealthit.org/smart-style.json', patient: 'smart-1098667', refresh_token: 'token here', token_type: 'bearer', scope: 'openid profile offline_access launch patient/*.*', expires_in: 3600, id_token: 'id token here', access_token: 'access token here',
appContext: 'foo' }


Instead I see this:
tokenResponse: { need_patient_banner: true, smart_style_url: 'https://launch.smarthealthit.org/smart-style.json', patient: 'smart-1098667', refresh_token: 'token here', token_type: 'bearer', scope: 'openid profile offline_access launch patient/*.*', expires_in: 3600, id_token: 'id token here', access_token: 'access token here' }

No appContext. Does anyone have any insight into what I may be doing wrong here?

Thanks!

Kevin Shekleton

unread,
Aug 24, 2018, 12:16:18 PM8/24/18
to CDS Hooks
Michael - I'm guessing you're trying to do this in our CDS Hooks Sandbox (sandbox.cds-hooks.org), right? While the Sandbox supports appContext, the thing launching your SMART app also needs to be aware of this and support appContext. Are you using the HSPC Developer Sandbox to launch the CDS Hooks Sandbox by any chance?

Best,
Kevin

Michael G

unread,
Aug 24, 2018, 1:37:34 PM8/24/18
to CDS Hooks
Kevin - You're correct that I'm launching using the CDS Hooks Sandbox. However, I'm launching the SMART app using a Next JS container to handle the authorization and using express-session to manage and store session information. Perhaps this is where the appContext is lost? Apologies for any lack of clarity, I'm fairly new to the SMART on FHIR thing and I didn't build the Next JS container - it was given to me - so it's fairly new territory all around.

Kevin Shekleton

unread,
Aug 24, 2018, 2:26:26 PM8/24/18
to CDS Hooks
Quick question -- Are you going directly to the http://sandbox.cds-hooks.org to test your CDS Service and the cards/links that are returned?

Michael G

unread,
Aug 24, 2018, 4:13:55 PM8/24/18
to CDS Hooks
No we are launching from https://launch.smarthealthit.org, selecting CDS Hooks Service, and running an app that is extremely similar (essentially the same with some customized cards) to https://github.com/cds-hooks/sandbox-cds-services.git from there, which sends us to http://sandbox.cds-hooks.org.

Kevin Shekleton

unread,
Aug 24, 2018, 4:45:00 PM8/24/18
to CDS Hooks
Ah, thanks! I've logged an issue to the smart-launcher project on GitHub to get support added for appContext. You can follow it here: https://github.com/smart-on-fhir/smart-launcher/issues/5

-Kevin
Reply all
Reply to author
Forward
0 new messages