Connecting to external EHR (Epic)
# support
j
Hi all, I'm trying to see if I can use Medplum's Typescript libraries to authenticate and connect to an Epic Sandbox I've created (with ClientID and ClientSecret) I came across this Medplum post, where it looks like Codex has done something very similar: https://www.medplum.com/blog/codex-and-the-power-of-g10 At the bottom of the article, in the "How it Works" section, there's a snippet of Typescript code showing how it would be done. In my own attempt to reproduce this, I notice that the "startLogin()" function in the article defines parameters for "ClientId" and "ClientSecret". However, when I try to use the same bits of code, the "startLogin()" seems to expect only a username and password. Indeed, the "Related Resources" section at the very bottom of the article points to "Medplum SDK startLogin" => This link is broken. I was able to find the startLogin for username/password version here: https://www.medplum.com/docs/sdk/classes/MedplumClient#startlogin But alas, I can't find documentation for external Ehr Login that supports the code from the article. Any help/direction would be greatly appreciated. Thank you!
l
I've just been using the OAuth endpoint to get a token with my client id/secret https://www.medplum.com/docs/api/oauth/token
j
To clarify, I'm not trying to connect to my own Medplum instance. I'm trying to connect to my Epic Sandbox. Unless I'm misunderstanding the provided link, this looks like requesting a token from Medplum's endpoint, which is not what I'm trying to do.
l
Oh my bad, didn't know you could use medplum's SDK like that
looking at the code it seems to be
startClientLogin
? https://github.com/medplum/medplum/blob/main/packages/core/src/client.ts#L2594
which is on that page too
j
No worries. But I think that too is specifically for connecting to Medplum. Looking at the example in the comments of that function, the clientId and secret are named: "process.env.MEDPLUM_CLIENT_ID" and "process.env.MEDPLUM_CLIENT_SECRET" I don't think that function works for anything other than auth to Medplum directly.
r
hey Joshua, the client supports multiple kinds of flows with different kinds of credentials - I'll send you a DM
n
@reshma Can you send me a DM as well? I am trying to get it to work with Epic and Cerner (or others) as a POC.
r
Hey @ngtsmythe_50107 ! Since this was written there have been a few published implementations for these use cases. I recommend watvhing these as well:

https://youtu.be/r35OyzcpIaY▾

https://youtu.be/E8VD9rgadG0▾

Are you looking to build this POC on behalf of a company? Or health system?
n
Thanks for this! I work for a company that might enter into the EHR space and we are trying to get a sense on LOE to connect to patient data from various sources.
158 Views