Old module "Security token has expired" problem

Hello.

I’ve found a module for a quite old version of dolibarr. I’ve used the module builder to create a new module, and made a copy/paste for the content except for the */module/admin/setup and /module/core/modules and I’ve managed it to work.

However, after enabling the module, I’m not able to change permissions, for example, because I always get the “Security token has expired, so action has been cancelled. Please try again” error.

Does anyone have any clues what could be the cause?

The module has one form, that has this line “”

“MAIN_SECURITY_CSRF_WITH_TOKEN” is 0 and “$dolibarr_nocsrfcheck” is also 0

  1. Tried to play with those 2 but no change
  2. Tried to change "$_SESSION[‘token’] " to "$_GET[‘token’] " or “newToken()” but again no luck.

I have the same issue
Following this one too

adding
$dolibarr_nocsrfcheck=0;
into config.php helped…
it is secure ?

Hello,

No it’s not.

You should better check why.
The usual suspects :

  1. external modules
  2. PHP Session configuration