I used the python sample code provided in the link for get labels
it is showing error as “Client must be authenticated to access this resource”
I used the python sample code provided in the link for get labels
it is showing error as “Client must be authenticated to access this resource”
Thanks for your message and welcome to Atlassian Developer Community!
You need to provide an API token in the sample code to authenticate your request. You need to change line 9 in the sample:
auth = HTTPBasicAuth("email@example.com", "<api_token>")
Please read the following documentation if you wish to know more about basic HTTP authentication and API tokens:
–
Pawel
I changed that before posting the query here. eventhough it shows the same error.
I’ve copied & pasted the code sample, changed lines 7 & 9 (url of the Jira Cloud site, user email & API token) and the sample worked fine:
{
"isLast": true,
"maxResults": 1000,
"startAt": 0,
"total": 3,
"values": [
"some-label",
"some-other-label",
"yet-another-label"
]
}
Please make sure that you changed http://your-domain.atlassian.net
, email@example.com
& <api_token>
to correct values in the sample. Also can you check that the token you created at https://id.atlassian.com/manage-profile/security/api-tokens shows a recent “Last accessed” time after running the code sample?
–
Thanks!
Pawel
Yes, I did the same but still showing the same error.
when i checked the token accessed, it shows last 4 mins ahgo.
@PawelCegla its working now. its my mistake, username typo error
Great news!
Happy coding!
–
Pawel
Thanks @PawelCegla
Now i am facing when am using the JQL as below
{“errorMessages”:[“Field ‘labels’ does not exist or this field cannot be viewed by anonymous users.”],“warningMessages”:}
JQL query: query = {
‘jql’: ‘summary ~ ”CVE-2021-46143” AND status != Closed AND status != Done’
}
endpoint: url = “https://your-domain.atlassian.net/rest/api/3/search”
I’ve been able to run the sample Python code from Search for issues using JQL (GET) without any issues.
This error message:
Field ‘labels’ does not exist or this field cannot be viewed by anonymous users.
suggests that this is again an authentication issue.
Are you sure you replaced https://your-domain.atlassian.net
, email@example.com
& <api_token>
(lines 7 & 9 in the sample code) with proper Jira Cloud site URL, user email and API token values?
–
Thanks!
Pawel
@PawelCegla thanks working fine.
I have this error “No Users found : Client must be authenticated to access this resource.” > "{subdomain}/rest/api/3/user?accountId={account_id}’
" ,i am using oauth