Page 1 sur 1

Failure to authenticate REST API connection

Publié : lun. août 17, 2026 11:16 pm
par BarryTice
Several years ago I wrote some Python to access our Squash instance via the REST API, and it worked well for the need we had at the time.

Then it sat dormant for a while, as we didn't need that functionality.

Then we got bought by a different company, and our Squash instance moved to a different URL. In the process, our IT team updates our squash to `14.0.3.RELEASE`.

Now, when I try to run my same Python script, I'm getting a 401 error, even when I type a known-good username and password from a Linux command line.

Viewing Squash in the browser, my URL is `http://<our_domain>/squash/campaign-workspace`

My Python code is calling to `http://<our_domain>/squash/api/rest/latest/projects?projectName=<our_project>`

The invocation is being done as:

Code : Tout sélectionner

import requests
AUTH = (user, password)
response = requests.get(url, auth=AUTH)
I see here (https://www.squashtm.com/en/post/releas ... -available) that as of 2024, there's supposed to be the ability to authenticate with a token rather than username/password. But I also see here (https://tm-en.doc.squashtest.com/latest ... index.html) that this functionality isn't expected until August of 2027 (release 19.0), and I can't find the described means to generate a token for a user. So, I'm guessing that user/password authentication should still be valid.

I can log into directly Squash using the username and password, but it fails when I try to make the API connection.

As part of our transition, we did lose our https certificate for Squash. Now I'm hitting squash `http` rather than `https`. Does this have anything to do with it? If not, what's likely to be my problem here? Three years ago, my Python script ran flawlessly.

Thanks!

Re: Failure to authenticate REST API connection

Publié : mar. août 18, 2026 5:20 pm
par BarryTice
I've found here: https://tm-en.doc.squashtest.com/v14/re ... index.html that in 10.0 they added a configuration parameter that has to be set to allow basic authentication. I'm assuming that's what's blocking me, and I have a message in to our IT staff to get me access to the installation so I can try to find the right file and update it.

However, it still doesn't solve the issue of me not seeing any way to generate a token for a user, either as the user or as a Squash admin.

How do I do that?

Re: Failure to authenticate REST API connection

Publié : mar. août 18, 2026 8:10 pm
par BarryTice
Fine. Tokens are generated by users rather than by administrators. I won't say I've got this solved yet, but I'm on my own path to figure it out.