I have been trying to work with the Oauth library, but I cannot seem to resolve an issue.
As a test, I am trying to use the Epic (uscdi.epic.com) EMR API (which uses Oauth2 for authentication). I created a sample stack with a single button. On the button, I added the following code.
Code: Select all
on mouseUp
constant tAuthURL = "https://uscdi.epic.com/interconnect-uscdi-oauth/oauth2/authorize?response_type=code"
constant tToken = "https://uscdi.epic.com/test/smart"
constant tPort = 49152
put "KEY HERE" into clientKey["Test"]
put "KEY HERE" into clientKey["Production"]
--https://uscdi.epic.com/interconnect-uscdi-oauth/oauth2/authorize?response_type=code&redirect_uri=[redirect_uri]&client_id=[client_id]&state=[state]
-- OAuth2 pAuthURL,pTokenURL,pClientID,pClientSecret,pScopes,pPort,pParams
OAuth2 tAuthURL,'pToken', clientKey["Test"], , , tPort
if the result is not empty then
put the result & " " & it
end if
end mouseUp
The documentation is behind a password wall but registration is free.
To make it easier, I have attached it to this post. The section starts under "Standalone Launch."
The error I get is
"OAuth2 Error
Something went wrong trying to authorize the client. Please try logging in again.
© 2003-2019 Epic Systems Corporation"
Thank you for any advice.
Ed