How to resolve “FHIRBase.GETPatient failed: Failed to execute ‘atob’ on ‘Window’: The string to be decoded is not correctly encoded.” error?

Summary

I tried using the FHIRBase and FHIRClinical power platform connectors for my project. I got the following error.

FHIRBase.GETPatient failed: Failed to execute ‘atob’ on ‘Window’: The string to be decoded is not correctly encoded.

You will find the source code for the connector and sample app on GitHub.

In my scenario, I had the following two tenant environments.

  1. Power Platform tenant with an Azure AD and 25 demo users.
  2. An Azure instance with computing, storage, and other resources with Azure Health Data Services (AHDS).

Follow the following links for the learning and workshop to install AHDS.

Get started with Azure Health Data Services

After all the above steps, I was able to resolve this error.

Get started with Azure Health Data Services

Diagnostics steps.

Step # 1: I turned on the Edge Developers tools to see the Network traffic.

In my case, I noticed invoke calls made and the response was 401. Clearly, this was an Unauthorised user making the call through the connector. My Power Platform demo tenant’s user let’s say (Alex Weber) must be added as the Guest user in the second Azure AD tenant.

Step # 2: I tried again and I got the same error as before. I looked at the dev tools and this time I got the 403 response.

Now by 403, I got the Forbidden error which is better now. To resolve 403, I added the (Alex Weber) User in the FHIR – Contributor role in the Data Plane. Please follow this to learn about the roles for the FHIR API.

Step # 3: The Azure Healthcare API’s “user_imprsonation” permission consent must be granted.

Step # 4: Finally, make sure when you create the connector the first time in your Power Platform connection use the Azure FHIR APIAzure User.

As you see below, both the connectors were added to the Power Platform tenant and the Azure tenant.

Conclusion

After all the above steps, I was able to get the error resolved. Please see below.

I hope these few simple checks and fixes resolve the problem for you. In summary, make sure the User is in the FHIR Dataplance,

About Pankaj

I am a Developer and my linked profile is https://www.linkedin.com/in/pankajsurti/
This entry was posted in Azure, FHIR, Technical Stuff. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s