XSRF Token missing

I'm trying to use jira-python (plus some of my own scripts) to add users to a group. I keep getting an XSRF Token Missing error. I found this https://developer.atlassian.com/display/JIRADEV/Form+Token+Handlingbut my Java knowledge isn't strong enough to figure out how to Pythonize it, if that's even the right way to go.

3 answers

This widget could not be displayed.

Sorry I'm more expert with Confluence, but XSRF tokens are only useful when you POST a form. If you POST a JSON content, you shouldn't need it. Does it work if you use JSON instead of a form?

For the background knowledge, XSRF tokens only exist because it's possible to post an html form to another website, whereas it wouldn't be possible in Javascript because it would be a cross-site request.

This widget could not be displayed.

I'm afraid I don't follow what you're asking.

This widget could not be displayed.

If it tells you the XSRF token is missing, that means you're posting your data as a form. Can you show us the python code you're using for that?

Instead of posting a form, you should try to post json data:

  • Set a header to "application/json"
  • And use json.dump(your_data) to serialize the contents.

The result should be similar to the code sample which is next to the green tick on this page: http://stackoverflow.com/questions/9746303/how-do-i-send-a-post-request-as-a-json

The drawback is, it's up to the JIRA code you're targetting to accept to switch between JSON or forms, so we need to know which url you're targetting.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Friday in Jira

New 5k User Limit and Other Cloud Updates

Hi all! Lauren here from the Enterprise Cloud marketing team.  I have some exciting Cloud updates from #AtlassianSummit that I wanted to share. We want everyone in your organization to be ab...

119 views 0 3
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you