A user, MajorLinux, reported being unable to log into forums.thecookout.org via Discord, encountering a “csrf_detected” error after authentication. Others, like EricGT, confirmed seeing the same issue. Falco suggested updating to the latest version, advising to SSH into the server and run ./launcher rebuild app [5]. Despite rebuilding twice, the error persisted [6]. Reviewing logs revealed the CSRF error was tied to the Discord authentication flow [7]. The root cause was identified as using the third-party plugin featheredtoast/discourse-plugin-discord-auth instead of Discourse’s built-in Discord auth [8]. Switching to the built-in method resolved the issue. featheredtoast, the plugin maintainer, acknowledged the incompatibility and committed to updating the plugin to align with Discourse’s core. MajorLinux expressed gratitude for the help. Another user, Iceman, asked if a similar issue with the LDAP Auth plugin might be related, though no direct link was confirmed.
To further add to what I’m seeing, when I log into the Docker image and view the logs
/var/www/discourse/log/production.log
The error I’m seeing is:
(discord) Authentication failure! csrf_detected: OmniAuth::Strategies::OAuth2::CallbackError,
csrf_detected | CSRF detected
Started GET "/auth/failure?message=csrf_detected&strategy=discord" for 99.14.146.128 at 2019-09-11 21:19:27 +0000
Processing by Users::OmniauthCallbacksController#failure as HTML
Parameters: {"message"=>"csrf_detected", "strategy"=>"discord"}
Rendering users/omniauth_callbacks/failure.html.erb within layouts/no_ember
Rendered users/omniauth_callbacks/failure.html.erb within layouts/no_ember (0.1ms)
Rendered layouts/_head.html.erb (16.0ms)
Rendered common/_discourse_stylesheet.html.erb (0.4ms)
Rendered application/_header.html.erb (0.3ms)
Completed 200 OK in 21ms (Views: 17.8ms | ActiveRecord: 0.0ms)
Oh, that’d do it. My branch was the original repo for the plugin, and hasn’t been updated to allow for core’s plugin, like the repo under discourse was.
I’ll update that to mirror discourse’s repo as well. Sorry for the trouble, and well sleuthed!
Hi, maybe this isn’t the right topic (don’t know if I should open a different one) but I’m experiencing this issue with the LDAP Auth plugin. Can it be related?