OAuth2 Error - SMART on FHIR (OAuth 2.0)

1,201 views
Skip to first unread message

ghanlon3

unread,
Jul 15, 2022, 10:23:26 AM7/15/22
to SMART on FHIR
I recently created an account on https://fhir.epic.com/ and I'm launching my app via the try it button on https://fhir.epic.com/Documentation?docId=launching . I'm following the OAuth2 tutorial for EHR launch, and I'm unable to get an authorization token. I get a 200 response but I see this error message:

OAuth2 Error
Something went wrong trying to authorize the client. Please try logging in again.

I've looked at the troubleshooting guide and I believe I have the correct redirect URI (although what does E0E stand for?), and I've waited over 12 hrs for the client to sync. The client ID is correct, and not the production client ID. I'm using the /authorize end pt, including the proper aud (I believe), and have the Content-Type set appropriately. :

  • Check that the redirect URI matches the redirect URI in the E0E record and the Endpoint URI listed on the app, and wait for the client to sync before testing any changes.
  • Check that the client ID in the request matches the client ID of the app, and that the response_type is code.
  • If you have a backend app encountering this error code, make sure the URL you're hitting ends in "/token" instead of "/authorize".
  • Make sure you're including a proper "aud" parameter in the request.
  • If using a POST request, make sure your body is of Content-Type: application/x-www-form-urlencoded instead of application/json, and make sure your request data is in the body instead of the query string (vice versa for GET requests).

In case you're curious, I'm using a POST to this URL:

with the following body:

response_type=code&client_id=9daf9be1-1cc8-4a84-8643-c2ba68285612&redirect_uri=http%3A%2F%2Flocalhost%3A8001%2Fv1%2Fepic%2Flaunch&scope=launch&launch=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJ1cm46b2lkOmZoaXIiLCJjbGllbnRfaWQiOiI5ZGFmOWJlMS0xY2M4LTRhODQtODY0My1jMmJhNjgyODU2MTIiLCJlcGljLmVjaSI6InVybjplcGljOk9wZW4uRXBpYy1jdXJyZW50IiwiZXBpYy5tZXRhZGF0YSI6IjcxQ3FpakNpaHA3cDNqUU5LNFJObnhJVDByS0FKTzZYaXNuYnV1eEhmTEVBM1FXbExNWTU4ZFp5ZTJvaHdQN3J5RFAta1g2Tng4dHlKdlpWU19KaFNZd3B5SmxjSGZidkNMbDNnUVhoTERONTJGOFd2QW5VZjdYUFZpVG0yNlFZIiwiZXBpYy50b2tlbnR5cGUiOiJsYXVuY2giLCJleHAiOjE2NTc4MjExOTgsImlhdCI6MTY1NzgyMDg5OCwiaXNzIjoidXJuOm9pZDpmaGlyIiwianRpIjoiYmU0ZThhMzYtZTVhNC00ZGE4LWEzZmYtY2Y5NTNiY2RmYmRjIiwibmJmIjoxNjU3ODIwODk4LCJzdWIiOiJlU0tlNk1DbVVuenRHd1EuWldBaU1hdzMifQ.Iph3t_0j-_Q5NymEokFddtAtH4t9SpOh7YvjN2yohpwRnFC5Rgxco536-_IWyoxSdWWfGHxP79nMFvGvmPeQ6fyN9GQH2vDTcesKI1G5xixovDQTa6tDlY5cbNv99JUDkawmD-drLdFSH-9OnoL9BjN6TKUdzMGhMi2iKjuXPmJmT2lk5n7k17zSRJw7U4CoW2WWIUxxQZG5aTMuSAfjm7-Ahfa80BEOdXesOehKhbWW7bXq9w5a2zjmgc2UGvpSiT57hv9jDBD2Q_V7iSdYgL9zhZCe3yERFtya6ZA6_B72xmEfwryJOxZZAAgsPapi-cBpGcYEuN1vLaczQ2X1PA&aud=https%3A%2F%2Ffhir.epic.com%2Finterconnect-fhir-oauth%2Fapi%2FFHIR%2FR4&state=abc123'

and the following header:
 {'Content-Type': 'application/x-www-form-urlencoded', 'Content-Length': '1201'})"}

And I've attached pictures of my test app setup.

Any information is appreciated. Thank you!
TestAppSetup.png

tomo yamano

unread,
Jul 15, 2022, 10:59:42 PM7/15/22
to ghanlon3, SMART on FHIR

Hi,

According to the capture you shared, It seems that you need to choose https: 
Have you tried https?


Thanks !

CONFIDENTIALITY NOTICE:
The contents of this email message and any attachments are intended solely for the addressee(s) and may contain confidential and/or privileged information and may be legally protected from disclosure. If you are not the intended recipient of this message or their agent, or if this message has been addressed to you in error, please immediately alert the sender by reply email and then delete this message and any attachments. If you are not the intended recipient, you are hereby notified that any use, dissemination, copying, or storage of this message or its attachments is strictly prohibited.


--
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.
<TestAppSetup.png>

ghanlon3

unread,
Aug 5, 2022, 10:14:34 AM8/5/22
to SMART on FHIR
Thanks for the response. The issue wasn't https, I get a response using http. I changed a few things, but I think it mostly came down to waiting for the sandbox to recognize my client. I was also using EHR for a patient facing app, which wasn't what I wanted/needed. I switched to a standalone launch, waited a couple days (more than 12 hours) for the sandbox to recognize my client, and I made sure my scopes were correct, and it worked. I really think the sandbox recognizing the client ID was the most important part, though.

tomo yamano

unread,
Aug 5, 2022, 10:37:04 AM8/5/22
to ghanlon3, SMART on FHIR

Thanks for your share!
Good to know that the issue is fixed .



Bhushan Borole

unread,
Dec 5, 2022, 3:20:44 PM12/5/22
to SMART on FHIR
Hello,
Would it be possible for you to guide me on how to setup the first step to setup OAuth for backend systems. I am trying to learn and understand the epic FHIR.

Thanks,
Bhushan B

Reply all
Reply to author
Forward
0 new messages