# CSRF token is invalid

**URL:** <https://forum.mautic.org/t/csrf-token-is-invalid/4394>\
**Category:** Product Support\
**Created:** [June 16, 2016, 3:41pm UTC](https://forum.mautic.org/t/csrf-token-is-invalid/4394 "2016-06-16T15:41:12Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![ramosesera](https://avatars.discourse-cdn.com/v4/letter/r/3e96dc/32.png) [@ramosesera](https://forum.mautic.org/u/ramosesera)\
**Post date:** [June 16, 2016, 3:41pm UTC](https://forum.mautic.org/t/csrf-token-is-invalid/4394/1 "2016-06-16T15:41:12Z")

</div>

Hello,  
  
  
  
I’m unable to install mautic latest release on my vps.  
  
I always get “The CSRF token is invalid. Please try to resubmit the form.”  
  
I already set the session\_path in php.ini but the error remain.  
  
This is my [php.ini](http://paste.xcentrik.online/dinaxiwixakohuvo.vhdl) [http://paste.xcentrik.online/dinaxiwixakohuvo.vhdl](http://paste.xcentrik.online/dinaxiwixakohuvo.vhdl).  
  
  
  
system: Debian 8  
  
web server: Apache 2.4.20  
  
php 5.6.20

---

<div class="post-metadata">

**Author:** ![Plarcher](https://avatars.discourse-cdn.com/v4/letter/p/7bcc69/32.png) [@Plarcher](https://forum.mautic.org/u/Plarcher)\
**Post date:** [July 7, 2016, 5:44am UTC](https://forum.mautic.org/t/csrf-token-is-invalid/4394/2 "2016-07-07T05:44:26Z")

</div>

I have the same on cloud Mautic, emailed support, asked 5 times for help on Slack and haven’t be able to use cloud Mautic for 2 or 3 weeks…

---

<div class="post-metadata">

**Author:** ![ramosesera](https://avatars.discourse-cdn.com/v4/letter/r/3e96dc/32.png) [@ramosesera](https://forum.mautic.org/u/ramosesera)\
**Post date:** [June 16, 2016, 5:54pm UTC](https://forum.mautic.org/t/csrf-token-is-invalid/4394/3 "2016-06-16T17:54:21Z")

</div>

yes, the directory is writable by the webserver. i’v already restarted apache and php-fpm

---

<div class="post-metadata">

**Author:** ![ramosesera](https://avatars.discourse-cdn.com/v4/letter/r/3e96dc/32.png) [@ramosesera](https://forum.mautic.org/u/ramosesera)\
**Post date:** [June 16, 2016, 3:41pm UTC](https://forum.mautic.org/t/csrf-token-is-invalid/4394/4 "2016-06-16T15:41:12Z")

</div>

Hello,

I’m unable to install mautic latest release on my vps.  
I always get “The CSRF token is invalid. Please try to resubmit the form.”  
I already set the session\_path in php.ini but the error remain.  
This is my [php.ini](http://paste.xcentrik.online/dinaxiwixakohuvo.vhdl) [http://paste.xcentrik.online/dinaxiwixakohuvo.vhdl](http://paste.xcentrik.online/dinaxiwixakohuvo.vhdl).

system: Debian 8  
web server: Apache 2.4.20  
php 5.6.20

---

<div class="post-metadata">

**Author:** ![brianmhays](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/brianmhays/32/96_2.png) [@brianmhays](https://forum.mautic.org/u/brianmhays)\
**Post date:** [August 10, 2016, 3:08pm UTC](https://forum.mautic.org/t/csrf-token-is-invalid/4394/5 "2016-08-10T15:08:25Z")

</div>

I’m having the same problem now. It goes in an out with that error or Mautic cloud. Any solution?

---

<div class="post-metadata">

**Author:** ![lightweight](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/lightweight/32/92_2.png) [@lightweight](https://forum.mautic.org/u/lightweight)\
**Post date:** [August 21, 2016, 11:43pm UTC](https://forum.mautic.org/t/csrf-token-is-invalid/4394/6 "2016-08-21T23:43:22Z")

</div>

I had this error trying to upload a CSV of contacts for import (using the reference [mautic.net](http://mautic.net) implementation as a paying customer, with our own subdomain). Managed to get around it by switching browsers (and trial and error). Now getting same error again consistently (in both browsers) when trying to upload a new customised theme in /s/themes (for our subdomain of [mautic.net](http://mautic.net)). Any ideas what could be going wrong.

---

<div class="post-metadata">

**Author:** ![brianmhays](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/brianmhays/32/96_2.png) [@brianmhays](https://forum.mautic.org/u/brianmhays)\
**Post date:** [August 22, 2016, 2:21am UTC](https://forum.mautic.org/t/csrf-token-is-invalid/4394/7 "2016-08-22T02:21:37Z")

</div>

@lightweight @Plarcher I’ve temporarily fixed the problem by clearing all cookies for my Mautic domain. It works for a day or so then I have to clear the cookies again.

---

<div class="post-metadata">

**Author:** ![lightweight](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/lightweight/32/92_2.png) [@lightweight](https://forum.mautic.org/u/lightweight)\
**Post date:** [August 23, 2016, 10:35pm UTC](https://forum.mautic.org/t/csrf-token-is-invalid/4394/8 "2016-08-23T22:35:26Z")

</div>

Interesting, thanks, @brianmhays. That sounds like a bug… 🙂

---

<div class="post-metadata">

**Author:** ![lightweight](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/lightweight/32/92_2.png) [@lightweight](https://forum.mautic.org/u/lightweight)\
**Post date:** [August 31, 2016, 10:18pm UTC](https://forum.mautic.org/t/csrf-token-is-invalid/4394/9 "2016-08-31T22:18:05Z")

</div>

I similarly found it works after clearing domain cookies… but then fails again shortly after a successful form submission.

---

<div class="post-metadata">

**Author:** ![artaxerxes99](https://avatars.discourse-cdn.com/v4/letter/a/ea666f/32.png) [@artaxerxes99](https://forum.mautic.org/u/artaxerxes99)\
**Post date:** [May 29, 2017, 2:10pm UTC](https://forum.mautic.org/t/csrf-token-is-invalid/4394/10 "2017-05-29T14:10:27Z")

</div>

We had the same problem when using Safari, but switching to Chrome or Firefox when accessing Mautic resolved the problem.

---

<div class="post-metadata">

**Author:** ![rauljauregi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/rauljauregi/32/4119_2.png) [@rauljauregi](https://forum.mautic.org/u/rauljauregi)\
**Post date:** [December 22, 2020, 3:59pm UTC](https://forum.mautic.org/t/csrf-token-is-invalid/4394/11 "2020-12-22T15:59:15Z")

</div>

I have this issue when editing a form. Is there any kind of solution?

---

<div class="post-metadata">

**Author:** ![mikew](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mikew/32/5156_2.png) [@mikew](https://forum.mautic.org/u/mikew)\
**Post date:** [December 23, 2020, 8:34am UTC](https://forum.mautic.org/t/csrf-token-is-invalid/4394/12 "2020-12-23T08:34:00Z")

</div>

+1 here. I have this issue on certain installations and other not. I am sure it must be a server configuration and maybe not mautic, but interested to hear if anyone sheds some light on the matter
