Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sign in via Slack causes 500 error "csrf_detected | CSRF detected" #60

Open
noahd1 opened this issue Feb 28, 2018 · 1 comment
Open

Comments

@noahd1
Copy link

noahd1 commented Feb 28, 2018

Unsure at the moment what causes this, but it seems, googling around, that it's perhaps not specific to omniauth-slack, but I don't understand the problem well enough to say.

Stacktrace:

web_1  | I, [2018-02-28T19:28:30.178720 #1]  INFO -- omniauth: (slack) Callback phase initiated.
web_1  | E, [2018-02-28T19:28:30.185502 #1] ERROR -- omniauth: (slack) Authentication failure! csrf_detected: OmniAuth::Strategies::OAuth2::CallbackError, csrf_detected | CSRF detected
web_1  | E, [2018-02-28T19:28:30.185941 #1] ERROR -- omniauth: (slack) Authentication failure! invalid_credentials: OmniAuth::Strategies::OAuth2::CallbackError, csrf_detected | CSRF detected
web_1  |
web_1  | OmniAuth::Strategies::OAuth2::CallbackError (csrf_detected | CSRF detected):
web_1  |
web_1  | omniauth (1.8.1) lib/omniauth/failure_endpoint.rb:25:in `raise_out!'
web_1  | omniauth (1.8.1) lib/omniauth/failure_endpoint.rb:20:in `call'
web_1  | omniauth (1.8.1) lib/omniauth/failure_endpoint.rb:12:in `call'
web_1  | omniauth (1.8.1) lib/omniauth/strategy.rb:486:in `fail!'
web_1  | omniauth-oauth2 (1.3.1) lib/omniauth/strategies/oauth2.rb:75:in `callback_phase'
web_1  | omniauth (1.8.1) lib/omniauth/strategy.rb:236:in `callback_call'
web_1  | omniauth (1.8.1) lib/omniauth/strategy.rb:188:in `call!'
web_1  | omniauth (1.8.1) lib/omniauth/strategy.rb:168:in `call'
web_1  | omniauth (1.8.1) lib/omniauth/strategy.rb:190:in `call!'
web_1  | omniauth (1.8.1) lib/omniauth/strategy.rb:168:in `call'
web_1  | omniauth (1.8.1) lib/omniauth/builder.rb:63:in `call'

Other Omniauth issues related to CSRF:

omniauth/omniauth-github#37
omniauth/omniauth-oauth2#32
auth0/omniauth-auth0#49

Initializer code:

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :slack, ENV['SLACK_APP_ID'], ENV['SLACK_APP_SECRET'], scope: 'identity.basic', name: :sign_in_with_slack, team: "foo"
  provider :slack, ENV['SLACK_APP_ID'], ENV['SLACK_APP_SECRET'], scope: 'dnd:read,dnd:write', team: "foo"
end

Versions:

  • omniauth (1.8.1)
  • omniauth-oauth2 (1.3.1)
  • omniauth-slack (2.3.0)
  • Rails 5.1.4
  • Ruby 2.3.3
@jayelkaake
Copy link

I think this happens because Slack does not always provide the state value if you come from their end, although I haven't been able to figure out a solution to that...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants