# CSRF token error. Try to refresh the page and try again

**URL:** <https://forum.mautic.org/t/csrf-token-error-try-to-refresh-the-page-and-try-again/16839>\
**Category:** Product Support\
**Created:** [November 3, 2020, 10:42am UTC](https://forum.mautic.org/t/csrf-token-error-try-to-refresh-the-page-and-try-again/16839 "2020-11-03T10:42:06Z")\
**Posts on this page:** 1\
**Showing post:** 22

<div class="post-metadata">

**Author:** ![mzagmajster](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mzagmajster/32/687_2.png) [@mzagmajster](https://forum.mautic.org/u/mzagmajster)\
**Post date:** [January 20, 2022, 2:01pm UTC](https://forum.mautic.org/t/csrf-token-error-try-to-refresh-the-page-and-try-again/16839/22 "2022-01-20T14:01:37Z")

</div>

Another ugly fix for Mautic 3 instance is to replace the template Views:User:Security:ajax.html.php template

I encountered this error if the user has been logged out and I logged back in using ajax render login form.

I solved it by forcing complete refresh of login page which also regenerates the CSRF token:

```auto
<?php
$view->extend('MauticCoreBundle:Default:content.html.php');
$view['slots']->set('headerTitle', $view['translator']->trans('mautic.user.auth.expired.header'));
?>

<script type="text/javascript">
    window.location.reload();
</script>

```

Hope it helps someone.  
Regards, M.

---

_[View the full topic](https://forum.mautic.org/t/csrf-token-error-try-to-refresh-the-page-and-try-again/16839)._
