Hello there (General Kenobi)!
I’ve seen a few posts about the topic but nothing with definite answer. I think it is due to large spectrum of applications of Jira api’s.
My company is using Jira cloud and I gave myself a task to create a dashboard that will collect data from various sources that the IT department uses such as Jira, Github, Slack, etc…
Naturally I opted for a token based auth because of multiple different api calls the dashboard will have to make. I got my api token and when I try making requests to https://myCompanyName.atlassian.net/rest/agile/latest/board through Postman (or terminal using curl) I get a nice response. However, when I try making the same request from my React app my request fails before it can ever reach the server. If I start the Chrome browser with --disable-web-security flag everything works just fine but that is far from optimal. I am using axios npm package for making these requests.
Can anyone give me any tips on how to get this to work and what would be the easiest solution.
Do I have to whitelist my localhost url to make it work?
For further explanation: The problem why we don’t support CORS directly on your site host/domain is that we accept session based authentication on there, which would then allow any site to make random, authenticated requests to your site.
The alternative is to proxy your requests through your own backend
Is CORS whitelisting supported?
CORS whitelisting is supported for api.atlassian.com . CORS whitelisting allows OAuth 2.0 authorization code grants to work for browser-based XHR or fetch requests subject to cross-origin restrictions, such as Chrome or Electron apps.
Also, from the same documentation:
Requests that use OAuth 2.0 (3LO) are made via api.atlassian.com (not https://your-domain.atlassian.net ). Construct your request URL using the following structure:
Hi,
I don’t have a JIRA app but a SaaS service from where I’d like to make JIRA API calls.
It’s transparent to the user and hence, I can’t redirect the user to a URL to get the code.
I have to use OAUTH2 otherwise I get a CORS error.
How can I make my service work with JIRA API?