Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Standalone Launch #38

Open
burningSchadow42 opened this issue Nov 17, 2024 · 4 comments
Open

Support for Standalone Launch #38

burningSchadow42 opened this issue Nov 17, 2024 · 4 comments

Comments

@burningSchadow42
Copy link

I could not get the app to authenticate under Windows in standalone launch.
Is that possible?

@plynchnlm
Copy link
Member

plynchnlm commented Nov 18, 2024

The app uses the EHR launch, or alternatively will take a base URL to an open FHIR server. It does not provide a way to do a standalone launch. However, it should not be too difficult to add that, since the SMART on FHIR part is handled by the fhirclient library, which does support the standalone launch option (https://docs.smarthealthit.org/client-js/api).

@burningSchadow42
Copy link
Author

I managed to add the standalone launch by changing the launch.html.
But for some reason I am having problems getting the patient, eventhough it is included in the Token.
Do you haven any idea what could cause something like this?

@plynchnlm
Copy link
Member

plynchnlm commented Nov 19, 2024

I am not sure. I assume you still have "launch/patient" as a part of the scope requested in launch.html? You might also try adding patient/*.rs, but I don't think that should be necessary to get the patient resource. (I am looking at https://hl7.org/fhir/smart-app-launch/scopes-and-launch-context.html#scopes-for-requesting-fhir-resources for information on the scopes.) Are you getting the chance to select a patient?

Now I see you might be trying to specify a patient. I think the EHR system is supposed to help you pick one. I don't know if there is a way to specify a patient in a SMART on FHIR launch.

@burningSchadow42
Copy link
Author

Thank you for the support and quick answer, I managed to get it running.
The problem actually was that the smart-on-fhir client-js library expects there to be a "patient" header in the Token response, something that is not properly documented and that Keycloak can not do out of the box.

But I finally got it to work!

I only needed to chang the last scripts tag in launch.html to the following:

<script>
  FHIR.oauth2.authorize({
    "client_id": "smart_pro_frontend",  // hard coded client_id to work with SMART on FHIR starter server
    "scope":  "openid profile launch/patient fhirUser user/*.* ",
    "iss": "http://localhost:8080/fhir/",
    "redirectUri": "http://localhost:8000/lforms-fhir-app/"
  });
</script>

(Although I think the proper way would be to create a launch-patient.html and include it)

I also added a redirect in the index.js where the console.log("Could not establish a SMART connection."); command is. But that is only necessary if you do not want to directly call /launch.html everytime.

I hope this helps someone and thank you for your time :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants