Forums

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

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 Champion
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
atlassian, atlassian community, loom ai, atlassian loom ai, loom, atlassian ai, record recaps of meetings, meeting recaps, loom recaps, share meeting recaps,

Loom’s guide to great meetings 📹

Join us to learn how your team can stay fully engaged in meetings without worrying about writing everything down. Dive into Loom's newest feature, Loom AI for meetings, which automatically takes notes and tracks action items.

Register today!
AUG Leaders

Atlassian Community Events