Hi Experts,
I'm running a React JS app, and from there, I'm trying to create a new issue under a project in the JIRA using axios with post method. But getting error with status : 403 (Forbidden) and response : XSRF check failed.
Please refer to below the code:
So, could you please help me in fixing the POST method with data to be posted as shown in the screenshot above?
Please note that, axios with GET method is working fine with url like below
let url = "https://cors-anywhere.herokuapp.com/https://jsw.ibm.com/rest/api/2/issue/QAHUB-1?fields=description";
I had the same problem and after checking for the whole day I found that the problem with the request is the user-agent in the header.
I was using chrome to test creating a request by Jira service desk api and I got the same error 403 (Forbidden)
I just test my app on Safari and Firefox and It works fine
@Som Sarkar I'm facing now the same issue.
Did you find a solution?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Consider checking this doc
https://confluence.atlassian.com/cloudkb/xsrf-check-failed-when-calling-cloud-apis-826874382.html
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Italo Qualisoni [e-Core] I've checked that doc but couldn't get much help as my use case is with axios. So I've shared the code in the screen shot and kindly let me know what to adjust to get this working.
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think you need to add the X-Atlassian-Token
header to each request, setting the value to no-check
headers:{
'X-Atlassian-Token':'no-check'
}
Also I'm not sure why you are using https://cors-anywhere.herokuapp.com instead of the direct url.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Italo Qualisoni [e-Core]I tried with below additional in headers, still getting same error.
'X-Atlassian-Token':'no-check'
Please help if there is any other way to correct the POST method using axios.
For your info, we're using https://cors-anywhere.herokuapp.com instead of the direct url to overcome CORS policy issue as per reference from this below link.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Som Sarkar ,
Can you try the command using Postman?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Also I think you should run the code in your nodejs backend instead of running on browser.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.