Issue with Auth Codes from MyChart

124 views
Skip to first unread message

Stephen

unread,
Jan 24, 2019, 1:28:00 PM1/24/19
to SMART on FHIR
Hello,

I have my OAuth2 flow working but when I redirect to sign in to mychart to grant access using fhirjason, the page indicates that the access will expire instantly (see attached image). It is preventing me from actually adding my app to fhirjasons linked apps list and preventing me from trading the code for an auth token (it says the code is expired already when I try and trade it for a token).

Anyone else getting this issue?



Thanks,
Steve.
access.png

Steve Davis

unread,
Jan 30, 2019, 8:47:45 AM1/30/19
to SMART on FHIR
Bueller? I still can't seem to exchange my auth code for a token as it expires instantly. Hoping someone can help guide me.

Michele Mottini

unread,
Jan 30, 2019, 9:42:46 AM1/30/19
to SMART on FHIR
Works OK for me for what's worth

You can try to ask Epic: email op...@epic.com

  - Michele
  CareEvolution Inc

Message has been deleted

Stephen

unread,
Jan 30, 2019, 10:53:11 AM1/30/19
to SMART on FHIR
I am happy someone responded, thanks! Maybe you can help me out...

When I try and swap out the code for a token it gives me this error back 
{
   "name":"Error",
   "status":400,
   "message":"Bad Request",
   "context":{
      "error":"invalid_client",
      "error_description":"A valid client was not found with the credentials provided"
   }
}

This only fails when I use the clientId from the app I setup in "MyApp" on epic. The epic launchpad here https://open.epic.com/Launchpad/OAuth2Ssoworks fine with the code I am running and my code is able to exchange the auth code from epic for a token and I can get data. Am I missing something? I am following the instructions exactly and inspecting the URL before it's sent, it matches the OAuth2 tutorial on epic's website.

My request looks identical to this, with the exception that I have substituted in the correct values for my particular app (clientId etc).

POST https://open-ic.epic.com/argonaut/oauth2/token HTTP/1.1 Content-Type: application/x-www-form-urlencoded grant_type=authorization_code&code=QY4IDRFBZOPtYenTOAZK34mSYX%2BCcVOJLj%2BKkTAmMRp4DHYtN6JOp%2FILMjRk1mkl%2Bnllz5yLwixKGs2wwEodUTvEegYMi%2FwKCD9ZiH2MsURO%2FW9yUfuQJW8fDbBrBUTF&redirect_uri=http://localhost:8000&client_id=324C2091A1CB4A319FBB3FC805863F0A

Again, my code only fails to exchange the auth code for the token when I use the clientId from the "app" I created in "MyApp" on epics website. Using the launchpad here https://open.epic.com/Launchpad/OAuth2Sso, my app works fine and I am able to exchange the auth code for a token and request data.

Thanks for any help you can provide!

Michele Mottini

unread,
Jan 30, 2019, 10:57:57 AM1/30/19
to SMART on FHIR
Not sure. At a glance that request looks fine - I'd say that either the client ID or the redirect are wrong?

  - Michele
  CareEvolution Inc

Stephen

unread,
Jan 30, 2019, 11:01:11 AM1/30/19
to SMART on FHIR
ClientId is the one that is listed as "non-prod" in MyApp and the redirect should be good, its the same as in the launchpad :S

Michele Mottini

unread,
Jan 30, 2019, 11:07:15 AM1/30/19
to SMART on FHIR

the redirect should be good, its the same as in the launchpad :S

It should be one you registered for the app...is it?

  -Michele 
  CareEvolution Inc

Stephen

unread,
Jan 30, 2019, 11:13:11 AM1/30/19
to SMART on FHIR
Yeah it's the same. I meant that when I plug it into the launchpad it works. 

Here it is in the launchpad.

redirect.png

Reply all
Reply to author
Forward
0 new messages