Problem using Discourse OAuth basic


(Nico) #1

Hi everyone,

I’m trying to implement OAuth in Discourse. We currently have a OAuth authentication mechanism implemented and being used by other applications. I have correctly (?) configured Discourse:

However, every time I try to login we get an error message. Looking at the logs I found the following error:
(oauth2_basic) Authentication failure! invalid_credentials: OAuth2::Error, {"access_token":"eef0166622530091135ed46b3af7ae338686a40e","token_type":"bearer","scope":"read_products","user_id":"296828"}

Here is the stacktrace:

```/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/logster-1.2.5/lib/logster/logger.rb:76:in add_with_opts' /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/logster-1.2.5/lib/logster/logger.rb:37:inadd’
/usr/local/lib/ruby/2.3.0/logger.rb:507:in error' /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/omniauth-1.3.1/lib/omniauth/strategy.rb:158:inlog’
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/omniauth-1.3.1/lib/omniauth/strategy.rb:474:in fail!' /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/omniauth-oauth2-1.3.1/lib/omniauth/strategies/oauth2.rb:82:inrescue in callback_phase’
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/omniauth-oauth2-1.3.1/lib/omniauth/strategies/oauth2.rb:71:in callback_phase' /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/omniauth-1.3.1/lib/omniauth/strategy.rb:227:incallback_call’
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/omniauth-1.3.1/lib/omniauth/strategy.rb:184:in call!' /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/omniauth-1.3.1/lib/omniauth/strategy.rb:164:incall’
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/omniauth-1.3.1/lib/omniauth/strategy.rb:186:in call!' /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/omniauth-1.3.1/lib/omniauth/strategy.rb:164:incall’
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/omniauth-1.3.1/lib/omniauth/strategy.rb:186:in call!' /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/omniauth-1.3.1/lib/omniauth/strategy.rb:164:incall’
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/omniauth-1.3.1/lib/omniauth/strategy.rb:186:in call!' /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/omniauth-1.3.1/lib/omniauth/strategy.rb:164:incall’
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/omniauth-1.3.1/lib/omniauth/strategy.rb:186:in call!' /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/omniauth-1.3.1/lib/omniauth/strategy.rb:164:incall’
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/omniauth-1.3.1/lib/omniauth/strategy.rb:186:in call!' /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/omniauth-1.3.1/lib/omniauth/strategy.rb:164:incall’
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/omniauth-1.3.1/lib/omniauth/strategy.rb:186:in call!' /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/omniauth-1.3.1/lib/omniauth/strategy.rb:164:incall’
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/omniauth-1.3.1/lib/omniauth/builder.rb:63:in call' /var/www/discourse/config/initializers/008-rack-cors.rb:15:incall’
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/rack-1.6.4/lib/rack/conditionalget.rb:25:in call' /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/rack-1.6.4/lib/rack/head.rb:13:incall’
/var/www/discourse/lib/middleware/anonymous_cache.rb:127:in call' /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.7/lib/action_dispatch/middleware/params_parser.rb:27:incall’
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.7/lib/action_dispatch/middleware/flash.rb:260:in call' /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/rack-1.6.4/lib/rack/session/abstract/id.rb:225:incontext’
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/rack-1.6.4/lib/rack/session/abstract/id.rb:220:in call' /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.7/lib/action_dispatch/middleware/cookies.rb:560:incall’
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.7/lib/active_record/query_cache.rb:36:in call' /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/rails_multisite-1.0.4/lib/rails_multisite/connection_management.rb:225:incall’
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.7/lib/action_dispatch/middleware/callbacks.rb:29:in block in call' /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7/lib/active_support/callbacks.rb:88:inrun_callbacks
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7/lib/active_support/callbacks.rb:778:in _run_call_callbacks' /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activesupport-4.2.7/lib/active_support/callbacks.rb:81:inrun_callbacks’
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.7/lib/action_dispatch/middleware/callbacks.rb:27:in call' /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.7/lib/action_dispatch/middleware/remote_ip.rb:78:incall’
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.7/lib/action_dispatch/middleware/debug_exceptions.rb:17:in call' /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.7/lib/action_dispatch/middleware/show_exceptions.rb:30:incall’
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/logster-1.2.5/lib/logster/middleware/reporter.rb:31:in call' /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/railties-4.2.7/lib/rails/rack/logger.rb:38:incall_app’
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/railties-4.2.7/lib/rails/rack/logger.rb:22:in call' /var/www/discourse/config/initializers/100-quiet_logger.rb:13:incall_with_quiet_assets’
/var/www/discourse/config/initializers/100-silence_logger.rb:26:in call' /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/actionpack-4.2.7/lib/action_dispatch/middleware/request_id.rb:21:incall’
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/rack-1.6.4/lib/rack/methodoverride.rb:22:in call' /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/rack-1.6.4/lib/rack/runtime.rb:18:incall’
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/rack-1.6.4/lib/rack/sendfile.rb:113:in call' /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/rack-mini-profiler-0.10.1/lib/mini_profiler/profiler.rb:171:incall’
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/message_bus-2.0.1/lib/message_bus/rack/middleware.rb:62:in call' /var/www/discourse/lib/middleware/request_tracker.rb:73:incall’
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/railties-4.2.7/lib/rails/engine.rb:518:in call' /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/railties-4.2.7/lib/rails/application.rb:165:incall’
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/railties-4.2.7/lib/rails/railtie.rb:194:in public_send' /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/railties-4.2.7/lib/rails/railtie.rb:194:inmethod_missing’
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/rack-1.6.4/lib/rack/urlmap.rb:66:in block in call' /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/rack-1.6.4/lib/rack/urlmap.rb:50:ineach’
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/rack-1.6.4/lib/rack/urlmap.rb:50:in call' /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:562:inprocess_client’
/var/www/discourse/lib/scheduler/defer.rb:85:in process_client' /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:658:inworker_loop’
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:508:in spawn_missing_workers' /var/www/discourse/vendor/bundle/ruby/2.3.0/gems/unicorn-5.1.0/lib/unicorn/http_server.rb:132:instart’
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/unicorn-5.1.0/bin/unicorn:126:in <top (required)>' /var/www/discourse/vendor/bundle/ruby/2.3.0/bin/unicorn:23:inload’
/var/www/discourse/vendor/bundle/ruby/2.3.0/bin/unicorn:23:in `’


Can anyone help me make sense of all of this? I can't figure out what's the problem :disappointed:

Thanks a lot!!