Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

EDITED: Error 401/403 on accessing worklog JIRA Cloud BUMP

vncnt274
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 5, 2018

I'm trying to write an app that's accessing JIRA Cloud API and until now, everything worked fine. When providing my username/email and password in basic authentication, I'm able to retrieve information about the project and all its issues. The problem is, when I try to access worklog it doesn't work anymore. The application is working locally only and I don't feel the need to implement any other authentication than basic, maybe in the future.

My application is written in Angular. For now, I had to install Chrome plugin to add CORS header to every preflight request so I can get the data via web app as a temporary measure.

What is more, when I access the data using Postman, it works. What can be the reason that accessing the data using the same credentials returns 200 for some resources and 401 for other? I've never suspected writing such a simple app could cause so many problems.

 

 EDIT

All right, it turned out that the CORS plugin was not working they way it should have, I've updated the security by manually disabling it in Chrome settings. But now there's another problem - the POST method, which is actually the last I need to finish the app, returns 403. I still suspect it's connected to the CORS issue, so I'll try to proxy requests via an nginx proxy server. So I'm updating the question - is it really the CORS issue and if yes, is the nginx solution worth trying? I've never been doing anything with proxies so far so I'd have to learn it from zero, and time flies. Thanks for your help.

1 answer

0 votes
Warren
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 5, 2018

Which API call are you using to get the worklog? Is it a Jira API or a Tempo one?

vncnt274
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 5, 2018

It's the JIRA API. Every request I've used in my application comes from this domain:


https://developer.atlassian.com/cloud/jira/platform/rest/v3/

Actually, I didn't think about adding the exact request addresses in my post, so here they are:

The working one examples:

GET https://<mydomainname>.atlassian.net/rest/api/3/project/TEST

GET https://<mydomainname>.atlassian.net/rest/api/3/search?jql=project=TEST


Non working ones:

GET https://<mydomainname>.atlassian.net/rest/api/3/worklog/deleted

POST https://<mydomainname>.atlassian.net/rest/api/3/worklog/list


At start I thought that maybe I was doing a wrong POST and it returned 401 instead of BAD REQUEST, but then tried the GET and it was the same. The final request I'm trying to reach for is the POST one though, if it's of any help. The desired result of the application is to show all issues with their user worklogs in one view

Suggest an answer

Log in or Sign up to answer