# Authentication issue (Excel PowerQuery)

**URL:** <https://forum.loinc.org/t/authentication-issue-excel-powerquery/3079>\
**Category:** General\
**Created:** [June 9, 2026, 5:07pm UTC](https://forum.loinc.org/t/authentication-issue-excel-powerquery/3079 "2026-06-09T17:07:02Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![deckmm](https://forum.loinc.org/letter_avatar_proxy/v4/letter/d/838e76/32.png) [@deckmm](https://forum.loinc.org/u/deckmm)\
**Post date:** [June 9, 2026, 5:07pm UTC](https://forum.loinc.org/t/authentication-issue-excel-powerquery/3079/1 "2026-06-09T17:07:02Z")

</div>

Hi, I’m trying to pull a subset of LOINCs into Excel by attempting to connect PowerQuery to one of the APIs. I’ve tried everything I can think of, but I simply can not get authentication to work within Excel.

- If I paste the full URL into browser, it asks for uname and pw (and it’s fine).
- I have checked the password encryption a dozen times with different mechanisms, it looks fine.
- I have cleared data source settings a thousand times and reestablished the connection as “Anonymous” and have tried various combinations of privacy level; no joy.
- I’ve tried various additional header parameters (Content-Type, Access, etc.) – I’m no expert, but many things say I don’t need it at all. (And, frankly, it’s not getting past authentication, so the request format or content type doesn’t matter that much, right?)
- Neither uname nor pwd has a colon in it.

I saw previous posts from a while back about users having problems with authentication. Is this still an issue?? (@timbriscoe I hate to tag you, but you seem to have been able to help several people.)

Here’s the error:

> Permission Error: The credentials provided for the Web source are invalid. Please update the credentials through a refresh or in the Data Source Settings dialog to continue. (Source at [https://fhir.loinc.org/ValueSet/valid-hl7-attachment-requests.](https://fhir.loinc.org/ValueSet/valid-hl7-attachment-requests.))

| |
| --- |
| Here’s the code (p\_uname and p\_pwd are text variables; it doesn’t perform any differently if I paste the text here instead of using variables). |

> let  
> v\_domain = “[https://fhir.loinc.org/](https://fhir.loinc.org/)”,  
> v\_relpath = “ValueSet/valid-hl7-attachment-requests/”,  
> v\_accessToken = "Basic " & Binary.ToText(  
> Text.ToBinary(p\_uname & “:” & p\_pwd),  
> BinaryEncoding.Base64  
> ),
> 
> ```auto
> Source = Json.Document(
> Web.Contents(
> v_domain,
> [
> RelativePath = v_relpath,
> Headers = [
> #"Authorization" = v_accessToken
> ]
> ]
> )
> )
> 
> ```
> 
> in  
> Source

---

<div class="post-metadata">

**Author:** ![timbriscoe](https://forum.loinc.org/user_avatar/forum.loinc.org/timbriscoe/32/938_2.png) [@timbriscoe](https://forum.loinc.org/u/timbriscoe)\
**Post date:** [June 9, 2026, 6:49pm UTC](https://forum.loinc.org/t/authentication-issue-excel-powerquery/3079/2 "2026-06-09T18:49:46Z")

</div>

Hi Mary,

This certainly is an interesting use of FHIR in Excel. I’d certainly like to help you get this working as it could be a powerful tool for LOINC users.

I’m not very familiar with Power Query but I think I found a solution… or at least part of one.

In the Advanced Editor, I entered the following:

```auto
let
    Url = "https://fhir.loinc.org/ValueSet/valid-hl7-attachment-requests",

    Source = Json.Document(Web.Contents(Url, [
        Headers = [
            #"Accept" = "application/fhir+json"
        ]
    ]))
in
    Source

```

After hitting OK, it complained about failed authorization and prompted me to enter a new one. I chose Basic authorization and entered my LOINC username and password. It then succeeded. As I mentioned, I don’t have enough experience with Power Query to then handle the data, but it seems like you know that part well.

Please report back if this is successful for you—and if this use of our Terminology Service fits your overall needs.

---

<div class="post-metadata">

**Author:** ![timbriscoe](https://forum.loinc.org/user_avatar/forum.loinc.org/timbriscoe/32/938_2.png) [@timbriscoe](https://forum.loinc.org/u/timbriscoe)\
**Post date:** [June 9, 2026, 6:52pm UTC](https://forum.loinc.org/t/authentication-issue-excel-powerquery/3079/3 "2026-06-09T18:52:43Z")

</div>

Actually, you may want to use this URL instead:

```auto
https://fhir.loinc.org/ValueSet/$expand?url=http://loinc.org/vs/valid-hl7-attachment-requests

```

This is the expansion of that value set which includes all the members.

---

<div class="post-metadata">

**Author:** ![deckmm](https://forum.loinc.org/letter_avatar_proxy/v4/letter/d/838e76/32.png) [@deckmm](https://forum.loinc.org/u/deckmm)\
**Post date:** [June 9, 2026, 8:10pm UTC](https://forum.loinc.org/t/authentication-issue-excel-powerquery/3079/4 "2026-06-09T20:10:46Z")

</div>

Yeah, I was starting with the simpler data set to get authentication working before going to the full set. 😃

---

<div class="post-metadata">

**Author:** ![deckmm](https://forum.loinc.org/letter_avatar_proxy/v4/letter/d/838e76/32.png) [@deckmm](https://forum.loinc.org/u/deckmm)\
**Post date:** [June 9, 2026, 8:56pm UTC](https://forum.loinc.org/t/authentication-issue-excel-powerquery/3079/5 "2026-06-09T20:56:12Z")

</div>

Hi @timbriscoe, appreciate the quick response: I did this:

- closed all other Excel files
- cleared all data source settings (often an issue with power query)
- closed Excel
- reopened Excel (new file) – trying to start as fresh as possible
- pasted your code into blank query in Excel Power Query
- when it complained about credentials, chose “basic” and put in my uname and pw
- SAME ERROR as before (“could not authenticate with credentials provided”)

So maybe there’s something wrong with how my account is set up?? Any ideas? Any resets you can do (or nuke my account and I’ll start with a new one)?

(I don’t think I mentioned above: I get good results when I just go to the API URL directly – it asks for uname/pw if I’m not logged on, and there’s content.)

I had been using “anonymous” for the data source settings (Excel-level) and then specifying the basic creds inside the code (“Authorization” in the header) because something I ran across said that’s the only way to make it work with Excel. (And because it didn’t work the other way!) Even you yourself have used this before (cf one of your responses in 2024 here: [Search for LOINC codes with keywords using the FHIR REST API - #5 by timbriscoe](https://forum.loinc.org/t/search-for-loinc-codes-with-keywords-using-the-fhir-rest-api/1634/5) ). And frankly, it should be equivalent.

And yeah, If this can work, I think it’s a great way to get the data! One-click updates! Put in the work up-front to set it up the way you want it through PowerQuery, and it’s great from then on out!

---

<div class="post-metadata">

**Author:** ![deckmm](https://forum.loinc.org/letter_avatar_proxy/v4/letter/d/838e76/32.png) [@deckmm](https://forum.loinc.org/u/deckmm)\
**Post date:** [June 9, 2026, 10:23pm UTC](https://forum.loinc.org/t/authentication-issue-excel-powerquery/3079/6 "2026-06-09T22:23:33Z")

</div>

p.s. If I go to fhirloincorg, it shows a link for [fhir.loinc.org/api-docs](http://fhir.loinc.org/api-docs), which does not seem to show any documentation… 😕 It would help to have usable docs.

p.p.s. I can’t even authenticate with the most basic of queries:

> let  
> Source = Web.Contents(“[https://fhir.loinc.org/](https://fhir.loinc.org/)”)  
> in  
> Source

---

<div class="post-metadata">

**Author:** ![timbriscoe](https://forum.loinc.org/user_avatar/forum.loinc.org/timbriscoe/32/938_2.png) [@timbriscoe](https://forum.loinc.org/u/timbriscoe)\
**Post date:** [June 10, 2026, 12:08am UTC](https://forum.loinc.org/t/authentication-issue-excel-powerquery/3079/7 "2026-06-10T00:08:52Z")

</div>

The documentation for this service is located at [LOINC Terminology Service using HL7® FHIR® – LOINC](https://loinc.org/fhir/) .

There is nothing functionally different between viewing one of the example URLs in your web browser and using it as a destination in Excel. Both will request authentication if not provided.

Your company/organization may have web-based requests in Excel locked down. People opening spreadsheet attachments with malicious code is an attack vector. Perhaps check with your IT department.

You may also want to test it with a different API endpoint which does not require authentication. This one is a good source of testing data: [https://jsonplaceholder.typicode.com/users](https://jsonplaceholder.typicode.com/users).

---

<div class="post-metadata">

**Author:** ![deckmm](https://forum.loinc.org/letter_avatar_proxy/v4/letter/d/838e76/32.png) [@deckmm](https://forum.loinc.org/u/deckmm)\
**Post date:** [June 10, 2026, 12:31am UTC](https://forum.loinc.org/t/authentication-issue-excel-powerquery/3079/8 "2026-06-10T00:31:09Z")

</div>

Yeah, already tried other sites (without pw), they’re fine. I don’t have any other pw-protected sites I can try. (Although I had our local Jira working ~2-3 years ago…)

The documentation doesn’t actually specify what information is required (or not) – “Authorization” is not mentioned on the site, nor “Content-type” or a few other header keywords that sounded promising. There’s some amount of “just need to know REST API syntax,” and I’m not good at that (… although I know a LOT more now than I did a few days ago!). (I wish more documentation would assume that people don’t know anything.)

I’ll try to remember to post back if I find a solution for my issue. Odd (and very frustrating) that I can get to it in browser (where it does me no good), but not from Excel (which is the only place I ever want data). ☹

Good to have confirmation that it worked for you. Because yeah, anybody should be able to do this (with query parameters, even – both at the Excel level and at the LOINC level), and then it’s just a matter of hitting the refresh button once in a while (vs downloading and having to reapply all the transformations). I guess one could set it up as an indirect query: Download once, expand whatever is desired to a given location, and then create a separate “master” Excel file that reads from there and applies transformations (to update: download and re-expand over top of the old files and then refresh the master).

Happy refreshing!

---

<div class="post-metadata">

**Author:** ![deckmm](https://forum.loinc.org/letter_avatar_proxy/v4/letter/d/838e76/32.png) [@deckmm](https://forum.loinc.org/u/deckmm)\
**Post date:** [June 17, 2026, 6:43pm UTC](https://forum.loinc.org/t/authentication-issue-excel-powerquery/3079/9 "2026-06-17T18:43:19Z")

</div>

Update: I tried from my personal laptop on home network and I was successful connecting to the API (essentially the Excel power query code posted above). So you’re right, @timbriscoe, that it’s networking limitation at my company.

(I didn’t pursue it much beyond the connection stage because it does me no good to have the information at home.)

Should work for others!

---

<div class="post-metadata">

**Author:** ![timbriscoe](https://forum.loinc.org/user_avatar/forum.loinc.org/timbriscoe/32/938_2.png) [@timbriscoe](https://forum.loinc.org/u/timbriscoe)\
**Post date:** [June 17, 2026, 8:26pm UTC](https://forum.loinc.org/t/authentication-issue-excel-powerquery/3079/10 "2026-06-17T20:26:42Z")

</div>

Thanks for the confirmation!

---

<div class="post-metadata">

**Author:** ![vztwo](https://forum.loinc.org/user_avatar/forum.loinc.org/vztwo/32/913_2.png) [@vztwo](https://forum.loinc.org/u/vztwo)\
**Post date:** [September 14, 2026, 1:21pm UTC](https://forum.loinc.org/t/authentication-issue-excel-powerquery/3079/11 "2026-09-14T13:21:35Z")

</div>

Hi Mary,

I’ve run into this with Power Query as well. The key issue is that the LOINC API uses authentication that Power Query’s standard Web connector doesn’t always handle the same way as a browser.

Rather than putting the username/password directly into the URL or relying on the basic authentication prompt, you may need to explicitly add the authentication information in the Power Query request (for example, using `Web.Contents` with the appropriate headers).

If you can share the specific LOINC API endpoint you’re trying to connect to (with the username/password removed), I’d be happy to provide the exact Power Query/M code needed to authenticate and pull the data into Excel.

---

<div class="post-metadata">

**Author:** ![deckmm](https://forum.loinc.org/letter_avatar_proxy/v4/letter/d/838e76/32.png) [@deckmm](https://forum.loinc.org/u/deckmm)\
**Post date:** [September 14, 2026, 3:11pm UTC](https://forum.loinc.org/t/authentication-issue-excel-powerquery/3079/12 "2026-09-14T15:11:05Z")

</div>

Hi vztwo, I did encode the unmae and pw – Tim gave me the code for it a while back (June 9).

Since I was successful using the powerquery code from my personal laptop but not from my work laptop, the issue (as Tim correctly surmised) is with my corporate firewall.

One might be able to get around this with Postman (as recommended by LOINC) – I can’t use that at my company. So I’m waiting for them to give me access to Insomnia, which I’m told should get me where I need to be. I will post back with my Insomnia results if they ever give me access.

-- mmd

---

<div class="post-metadata">

**Author:** ![deckmm](https://forum.loinc.org/letter_avatar_proxy/v4/letter/d/838e76/32.png) [@deckmm](https://forum.loinc.org/u/deckmm)\
**Post date:** [September 15, 2026, 6:50pm UTC](https://forum.loinc.org/t/authentication-issue-excel-powerquery/3079/13 "2026-09-15T18:50:00Z")

</div>

The latest: I have Insomnia, and I can get around my corp firewall to retrieve the information! 🙂

… but I don’t (yet?) have the command-line version, so I can’t automatically save it to a file (to be pulled into Excel). ☹

But that will be my model:

- figure out how to get info into a file in a common directory
  - might be able to do it just with Power Automate, but I think my situation requires Insomnia (or similar) and Power Automate
  - if I get command-line (inso.exe), I don’t need power automate for this step (might want to involve powershell)

- schedule refresh of that data on regular basis (with PowerAutomate or some other kind of scheduling)
- use that source to populate Excel PowerQuery
- then any time someone refreshes Excel, it reads from the most-recently-extracted information

(Not ideal, but better than not getting updates! People who can use Excel Power Query directly to pull the info do not have to go through this indirect nonsense.)

-- mmd

p.s. Can you think of a way to add any more “power” commands to my approach?? 😃 I can probably at least document it all in PowerPoint… 😉

---

<div class="post-metadata">

**Author:** ![talia84](https://forum.loinc.org/letter_avatar_proxy/v4/letter/t/8dc957/32.png) [@talia84](https://forum.loinc.org/u/talia84)\
**Post date:** [September 19, 2026, 8:12pm UTC](https://forum.loinc.org/t/authentication-issue-excel-powerquery/3079/18 "2026-09-19T20:12:17Z")

</div>

Likely Power Query caching, not the LOINC login. Clear the data source for [https://fhir.loinc.org/](https://fhir.loinc.org/), set it to Basic (not Anonymous), and don’t also send an Authorization header in M. Use Web.Contents + RelativePath, not the FHIR connector (that one doesn’t support Basic Auth). If curl -u user:pass works against the same URL, the account is fine. [😃](https://footballdailytips.com/)

---

<div class="post-metadata">

**Author:** ![deckmm](https://forum.loinc.org/letter_avatar_proxy/v4/letter/d/838e76/32.png) [@deckmm](https://forum.loinc.org/u/deckmm)\
**Post date:** [September 21, 2026, 2:35pm UTC](https://forum.loinc.org/t/authentication-issue-excel-powerquery/3079/19 "2026-09-21T14:35:18Z")

</div>

No, it’s my company’s firewall.

We don’t need any more solutions here, people. The issue is known.

---

<div class="post-metadata">

**Author:** ![timbriscoe](https://forum.loinc.org/user_avatar/forum.loinc.org/timbriscoe/32/938_2.png) [@timbriscoe](https://forum.loinc.org/u/timbriscoe)\
**Post date:** [September 22, 2026, 5:57pm UTC](https://forum.loinc.org/t/authentication-issue-excel-powerquery/3079/20 "2026-09-22T17:57:54Z")

</div>

Closed on September 22, 2026, 5:57pm UTC


