swingbit / jira2gitlab

Migrate Jira projects into a Gitlab instance
MIT License
20 stars 11 forks source link

jira-user-list.py fails with "401 Client Error: Unauthorized" #15

Closed ams-tschoening closed 1 year ago

ams-tschoening commented 1 year ago

I get the following error when invoking jira-user-list.py, while the same URL works when manually copied and executed in a browser.

401 Client Error: Unauthorized for url: https://riff-systemhaus.atlassian.net/rest/api/2/search?jql=project=%22GOERLITZ%22%20ORDER%20BY%20key&fields=*navigable,attachment,comment,worklog&maxResults=100&startAt=0

Tested the same with curl -u '[...]:[...]' [...] and received the following output:

Basic authentication with passwords is deprecated. For more information, see: https://developer.atlassian.com/cloud/confluence/deprecation-notice-basic-auth/

That link contains the following sentence, perfectly fine corresponding to my first error:

For the following APIs and pages, all requests using basic authentication with a non-API token credential will return 401 (Unauthorized) after the deprecation period:

Looking at the code, basic auth with username+password seems to be sued, so the error makes sense. OTOH, the script seems to be created after the deprecation?

The deprecation period for this functionality has ended. From June 3rd, 2019, we will be progressively disabling the usage of this authentication method.

Would be great if you could have a look at this problem. Thanks!

ams-tschoening commented 1 year ago

Didn't think of it first: One simply needs to replace the password in the secrets file with a created API token and this error goes away. :-)

swingbit commented 1 year ago

Indeed this script was created for the API v2 that is used in the Server version. If using the token makes it work for the cloud version, even better. I hope this was the only obstacle.