Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

xsrf check failed when create jira ticket via rest api

I have a web application built with angular 8 , I am trying to use http post to call JIRA rest API to create an issue from my application, when I use http get, i can successfully get the issue from JIRA api, but post method always give error: XSRF check failed even I set header "X-Atlassian-Token" as 'no-check'.

Even tried to set "jira.xsrf.enabled" as false in jira-application.properties

I am using Basic authentication as I am trying to use bot to create jira issue.

2 answers

Hi, I know this is a very old issue but I just stumbled upon this problem as well and I thought I might be able to help people with the same issue. In our case, there were two possible solutions. 

- Change User Agents Header (Not possible as far as I know in chrome)

- Whitelist/Allowlist the origin domain in Jira. When you send a request to the Jira API your browser automatically populates the "origin" header. You need to add that value to the whitelist/allowlist in Jira. -> See here Configuring the allowlist | Jira | Atlassian Documentation
Type "Domain" should work.

 

See the issue documented by Atlassian:

REST API calls with a browser User-Agent header may fail CSRF checks | Jira | Atlassian Documentation

0 votes
brbojorque Community Leader Dec 22, 2019

Hi @wenting liu ,

Based on this documentation you need to add a header like so.

X-Atlassian-Token: no-check

https://developer.atlassian.com/server/jira/platform/form-token-handling/

Suggest an answer

Log in or Sign up to
This widget could not be displayed.
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you