Error message

The spam filter installed on this site is currently unavailable. Per site policy, we are unable to accept new submissions until that problem is resolved. Please try resubmitting the form in a couple of minutes.

Drupal - Services CSRF Token with FireFox Poster


With the introduction of the CSRF Token a few months ago, service calls in Drupal need to pass along that token for certain resources. Using FireFox Poster, we can pass along this token to easily test and debug our services.

Here's an example to pass along the token for a simple article node creation.

Retrieve the Token and Copy it

Go to the following URL in your browser and copy the token:

Or grab it from inside FireFox Poster:

  1. Open FireFox Poster
  2. Enter the URL:
  3. Click the GET button
  4. Copy the token

Add the Token to the Header

  1. In FireFox Poster, click the Headers tab
  2. Enter the Name: X-CSRF-Token
  3. Enter the Value: [paste-your-token-here]
  4. Click the Add/Change button

Make the Service Request

  1. Enter the Service Resource URL, for example:
  2. Click the Parameters tab
  3. Enter a name: type
  4. Enter a value: article
  5. Click add/change
  6. Enter a name: title
  7. Enter a value: Hello World
  8. Click the "Content to Send" tab
  9. Click the "Body from Parameters" button
  10. Click the POST button

That's it!

That's all we need to do to attach the CSRF token to our requests that need it.


Thank you very much I tried to create a node with poster for more than 8 hours and your tutorial was the only one than worked. No one else mentioned that the URL should include /node.json intead of just /node. Thanks a lot!!

Add new comment