Closed (fixed)
Project:
Like/Dislike
Version:
2.2.0
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
8 Feb 2018 at 17:59 UTC
Updated:
8 Aug 2023 at 06:59 UTC
Jump to comment: Most recent
Register popup is not loading for anonymous users. Firebug showing the following message.
'csrf_token' URL query argument is invalid.
"message":"\u0027csrf_token\u0027 URL query argument is invalid."
Drupal 8.4.4/ php 7
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
DrupalDude777 commentedThis is related to another Drupal 8 core issue: https://www.drupal.org/project/drupal/issues/2730351
Comment #3
DrupalDude777 commentedBut as this https://www.drupal.org/project/drupal/issues/2730351 issue is still not resolved here is a workaround :
In /like_dislike/like_dislike.routing.yml you should replace the content by:
In /like_dislike/src/Plugin/Field/FieldFormatter/LikeDislikeFormatter.php replace lines 134 to 139 by this:
So this file content once changed should be:
The idea is to have a second route with the same path and same handler in controller but without csrf_token and to use it if the user is not connected.
Comment #4
DrupalDude777 commentedComment #5
DrupalDude777 commentedHere is a better coded version of /like_dislike/src/Plugin/Field/FieldFormatter/LikeDislikeFormatter.php (full content of the file):
Comment #6
heykarthikwithuHello DrupalDude777! Thank you.
I think it needs a patch.
Comment #7
heykarthikwithuComment #8
bill_redman commentedI installed this module and when trying it as an anonymous user got the 'cs_rf token' error. I found this issue and after applying the changes provided by @DrupalDude777 my error was resolved. However, when I again tried to Like my page as an anonymous user, I got the following error in the console:
Does this module not allow Like/Dislike by anonymous users or is something else wrong? If the module does not allow it, is there a way to change that? I really like the simple & clean look of the module and would like to be able to use it.
My site is using Drupal 8.9.20 & PHP 7.4
Comment #9
heykarthikwithuThanks you all for working on this issue.
Done some major fixes around like & dislikes within 2.2.0 release,
Have a check if this issue still exist with 2.2.0 version?
Please check for the module page for the features covered.
CSRF Token issues needs to be fixed.
Comment #11
heykarthikwithuAlternate solution is applied until this issue is fixed in core - https://www.drupal.org/project/drupal/issues/2730351
This will be released in the upcoming release.
Comment #12
heykarthikwithuFixed in latest 2.3.0 version.