Request headers for fetching resources using Standalone app

80 views
Skip to first unread message

Daya

unread,
Oct 11, 2018, 12:34:36 PM10/11/18
to Cerner FHIR Developers
Hi

I am trying to use fhir-client-jquery.js library for my standalone application. I am able to authenticate the user and receive the access token, refresh token, token_type "Bearer" using this code

  var clientId = 'my-client-id';
  var standalone = 'user/Patient.read user/Observation.read online_access openid profile';
  var params = {
    'client_id': clientId,
    'scope':  standalone
  };
  FHIR.oauth2.authorize(params);


but I am unable to proceed further using this code

 
  var callback = function(){
    extractData().then(
      //Display Patient Demographics and Observations if extractData was success
      function(p) {
        drawVisualization(p);
      },

      //Display 'Failed to call FHIR Service' if extractData failed
      function() {
        $('#loading').hide();
        $('#errors').html('<p> Failed to call FHIR Service </p>');
      }
    ); 
  };

  FHIR.oauth2.ready(callback);


The extractData function is the same as shown here in your github example.

Could someone please help
  1. Point to the functions in the fhir-client-jquery.js library I need to call  to fetch Patient & Observation resource while passing the access_token. Is there a sample code?
  2. List the request headers I need to pass and endpoint to call before I can fetch a FHIR resource.
Cerner-Correlation-ID:
f5a49f27-4f82-4ed1-a505-cc4f2244bc13


Thanks,

~Daya

Daya Sharma

unread,
Oct 11, 2018, 5:49:57 PM10/11/18
to cerner-fhir...@googlegroups.com
The problem is I am receiving 401 when calling Patient resource https://fhir-ehr.sandboxcerner.com/dstu2/0b8a0111-e8e6-4c26-a91c-5069cbc6b1ca/Patient/5226007 as I am not passing the required request headers of

Authorization:

What I am unable to understand is what causes the Authorization header to be passed when same app is launched from EMR? Debugging the JS libraries it reveals

javascript file jqFhir.js line 922

cfg = {baseUrl: "https://fhir-ehr.sandboxcerner.com/dstu2/0b8a0111-e8e6-4c26-a91c-5069cbc6b1ca", auth: {…}}, adapter = {defer: ƒ, http: ƒ}

Has a different cfg ( non null auth object) when app is invoked from within EMR but when invoked standalone auth object is null.

Any idea what I am doing wrong? Is there a configuration I need to setup before invoking the standalone app?

Thanks,
~Daya

--
You received this message because you are subscribed to a topic in the Google Groups "Cerner FHIR Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cerner-fhir-developers/Wy8GCtWhCuc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cerner-fhir-devel...@googlegroups.com.
To post to this group, send email to cerner-fhir...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/cerner-fhir-developers/113a5518-8dfc-4fa1-90ae-2f4b8fa0e14f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Michele Mottini

unread,
Oct 11, 2018, 5:56:12 PM10/11/18
to Cerner FHIR Developers
A standalone app has to initiate the authentication sequence itself - is your doing that? (redirecting to the authorization end point)

  - Michele
  CareEvolution Inc

Daya Sharma

unread,
Oct 11, 2018, 6:43:18 PM10/11/18
to cerner-fhir...@googlegroups.com
Yes, as mentioned in the first post, I am able to authenticate the user but unable to figure out what JS function to call to ensure Auth tokens are passed in the call to fetch/read Patient resource.

-daya

--
You received this message because you are subscribed to a topic in the Google Groups "Cerner FHIR Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cerner-fhir-developers/Wy8GCtWhCuc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cerner-fhir-devel...@googlegroups.com.
To post to this group, send email to cerner-fhir...@googlegroups.com.

Kol Kheang (Cerner)

unread,
Oct 19, 2018, 12:50:07 AM10/19/18
to Cerner FHIR Developers
Hi Daya,

I cannot find this f5a49f27-4f82-4ed1-a505-cc4f2244bc13 correlation ID in our system in the last 30 days.  Are you still have this issue?  If so, can you provide a different correlation ID for this issue?

Regards,
Kol

Daya Sharma

unread,
Oct 19, 2018, 11:01:41 PM10/19/18
to cerner-fhir...@googlegroups.com
Hi Kol,

Never mind I was able to figure out the headers needed to pass in by using a EMR launch app and Javascript debugger.

Regards,
~Daya

--
You received this message because you are subscribed to a topic in the Google Groups "Cerner FHIR Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cerner-fhir-developers/Wy8GCtWhCuc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cerner-fhir-devel...@googlegroups.com.
To post to this group, send email to cerner-fhir...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages