CORS error with React API Requests

Cecil Carter December 11, 2020

Hello, I'm trying to make a request using the JIRA API. I included the needed username and password, but I'm getting a CORS error.

I've tried both axios and fetch.

 

What do I need to make a request in React? Any example?

 

Example:

```

const res = await axios.post( "https://team.atlassian.net//rest/api/3/project/Test", {},

{

auth:

{

username,

password,

},

}

);

```

1 answer

0 votes
Hana Kučerová
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 12, 2020

Hi @Cecil Carter ,

welcome to the Atlassian Community!

Please see the documenation for the Jira cloud REST API. Basic auth could be used, but you should use API token instead of password, see here.

I would also recommend you to start with some simplier requests like GET project or issue. POST requests usually expects some additional data provided in your request.

There are also examples visible in the documentation. Not for the React, but still I believe it could help you.

I've also noticed your URL is not correct (two slashes), please use https://team.atlassian.net/rest/api/3/project/Test

Would you please provide us the exact error mesage you get?

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events