Not able to login into forums with Discord

AI-generated summary

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.

I am having an issue signing into our forum (forums.thecookout.org) after signing out.

After authenticating through Discord, I’m being sent to the following URL:

https://forums.thecookout.org/auth/failure?message=csrf_detected&strategy=discord

and getting the following error:

Authorization timed out, or you have switched browsers. Please try again.

I’m not entirely sure what’s going on and could use any help.

Thanks in advance!

FYI for others seeing this.

I have never been your site, but I also get

Not that I can help, but it may help others looking to help you.

Please update to latest, we recently changed the code around that.

How can I change it from cmd/Docker?

I am unable to get to the GUI.

SSH into the server

cd /var/discourse
./launcher rebuild app

I have attempted that twice and am still receiving the error.

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)

Apparently, the issue was stemming from using GitHub - featheredtoast/discourse-plugin-discord-auth: A Discourse plugin to login over Discord · GitHub for Discord authentication instead of the built-in method.

Not sure when it was added, but using it now and everything is working smoothly!

Thank you all for your assistance!

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!

No problem!

It was serving me well!

Thank you for leading the charge!

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?