Matomo instance is behind Basic HTTP Authentication?

Hey everyone

Was very glad to find the official Matomo plugin for looker studio!

Our Matomo instance is behind Basic HTTP Authentication. (The data collection endpoint is of course excluded.)

I have authorised the Looker Studio extension and it prompted me for the credentials. When I first tried to connect to my Matomo instance, I provided its address as https://matomo.example.com and clicked Connect just “to see what happens” and predictably I got Sorry, we submitted your credentials, but the credentials are invalid in response.

I adjusted the instance URL to be https://username:password@matomo.example.com (works when I test it in Private mode), but I keep getting the same error.

When I look at our server logs, I can only see the first request in there:

34.116.22.34 - - [12/Jan/2024:16:46:02 +0000] “POST /index.php?module=API&method=SitesManager.getSitesIdWithAtLeastViewAccess&format=JSON&fromLooker=1 HTTP/1.1” 401 172 “-” “Mozilla/5.0 (compatible; Google-Apps-Script; beanserver; +https://script.google.com; id: some_long_string)”

Apparently, the first response got cached and no further attempts reach our server. Or, the URL that has a username:password@ in it is considered invalid and is never tried at all.

I have tried editing the username in the username:password@ part, and even logged in from a different Google account in an attempt to reset the cache, but none of that helped.

Is this something you control as extension developers?

Hello @mehov, the only way we might be able to support this is via the username:password@ format, as we don’t control the UI authentication workflow. However, if the username:password@ URL did not even result in an attempt to connect to Matomo, then there may be something in Looker Studio that prevents those types of URLs from being saved/used. I’ll check some time this week if there’s a way to support this, or if not, if there’s a way to work around the issue.

Thank you for your reply.

I tried the username:password@ URL as username again and got the same results:

  • same error message in Looker Studio UI
  • nothing in my server logs

So it looks like the extension does not even try to connect.

Hi @mehov, it turned out there’s a bug in apps script causing the problem. It’s been worked around and using URLs with username:password@ should work. Can you give it a try and let me know?

1 Like

Yep, it works now. Thank you for your help and for fixing it so quickly!

(For reference, I used the full https://username:password@matomo.example.com as username.)