Epic app Orchard - sample web SMART on FHIR

3,031 views
Skip to first unread message

Paul Law

unread,
May 25, 2018, 6:01:00 AM5/25/18
to SMART on FHIR
Hi All,

Based on Epic's OAuth2 Tutorial, I created a sample SMART on FHIR web application (find the source code attached).
In brief, while requesting the authorization from the corresponding Epic's endpoint I encountered some issues. Below the steps I followed:
  1. Receive launch and iss parameters from the Lancher app (Simulator under Epic App Orchard).
  2. Send authorization request to Epic authorization endpoint with the following parameters:
    • response_type: = "code"
    • client_id: xxxx-xxxxxxxx-xxxxxxx... (I removed this code from the file attached).
    • redirect_uri: https://xxxxx/redirect.html
    • launch: the launch token (is passed from sandbox to this web app's launch URL)
    • state: random string as mentioned.
    • scope: = "launch"
  3. Send a request to the token endpoint to get an access token to consume FHIR resources using parameters below:
    • code: provided by Epic authorization endpoint after redirecting the browser to the redirect uri.
  4. Consume FHIR resources using the access token to get requested patient and his demographic and clinical data.
I couldn't do 3. & 4. because I got an error message [OAuth2 Error Something went wrong trying to authorize the client. Please try logging in again.] while using Simulator / SMART on FHIR (see attached).


Can you advise please.

Best,
Paul
Oauth2 error.png
launch.html
redirect.html

Michele Mottini

unread,
May 25, 2018, 9:04:16 AM5/25/18
to SMART on FHIR
Try to to send it to appor...@epic.com. This is a generic SMART mailing list, but the problem seems App-Orchard specific

  - Michele
  CareEvolution Inc


Kevin Dufendach

unread,
May 25, 2018, 9:07:17 AM5/25/18
to Paul Law, SMART on FHIR
Hi Paul,

I've received similar errors in the past, and most of the time it means that the server doesn't recognize my client_id. Be sure you're using your NON_PROD client_id when trying to connect to the Epic SANDBOX server. Also, if you were trying to both register and access in one day, you might just give it 24 hours and try again. I think Epic updates its client_id list nightly.

Regards,
Kevin

Kevin R. Dufendach, MD, MS, FAAP
Assistant Professor, Pediatrics and Biomedical Informatics
Neonatologist | Clinical Informatician


Cincinnati Children's
3333 Burnet Avenue, MLC 7024, Cincinnati, OH 45229



--
You received this message because you are subscribed to the Google Groups "SMART on FHIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to smart-on-fhi...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kathy

unread,
May 27, 2018, 8:58:54 PM5/27/18
to SMART on FHIR
Hi Paul,

I had follow the Epic's Tutorial to lunch standalone app. I received the code, but was having error do when doing POST to get token(step3).  The errors I got were:
a. Invalid grant = I was using new redirect_uri that I just added.  According to Epic, they refresh every 12hrs.
b. Invalid clientID = This is a misleading message.  When I use Encoded redirect_uri, I get this message.  When I just use normal url like http://localhose:8080, it works.  I receive access token.

Hope this will help.

Regards,
Kathy

Paul Law

unread,
May 28, 2018, 5:13:08 AM5/28/18
to SMART on FHIR
Hi Kathy,

Thanks for the response. Just want to mention I am not encoding the redirect_uri, with or without encoding it still not working for me.

Best

Kathy

unread,
May 28, 2018, 12:28:30 PM5/28/18
to SMART on FHIR
Hi, Paul,

Something really weird.  I had been launching successfully for days, but as of 9:30 last night.  I am starting to receive this error.  I went back and see my app setup.  I noticing weird characters append to my https url.  I know I entered it correctly.  I removed funny characters, save, open the setup again, and new funny characters show up.  I am wonder if it's on Epic side.  I Just email Epic; hopefully, I'll hear from them tomorrow.

Mic Fok

unread,
May 28, 2018, 5:12:48 PM5/28/18
to SMART on FHIR
Hey Kathy, 

I think there might be something up on Epic's side. 

When I tried to test their services using "Launching Your App" => "Smart On Fhir (Oauth2)", then selecting their test app "App Orchard SMART on FHIR test" I get errors indicating: "Unable to retrieve OAuth2 endpoints from FHIR server metadata."

Furthermore, when I try to launch the same way using my own app (using client.js http://docs.smarthealthit.org/clients/javascript/) I get errors indicating: "Failed to discover authorization URL" with details indicating the server at: "https://apporchard.epic.com/interconnect-ao83prd-username/api/FHIR/DSTU2" despite the OAuth2 Tutorial indicating the sandbox server should be: "https://apporchard.epic.com/interconnect-ao83prd-oauth/"
Reply all
Reply to author
Forward
0 new messages