omniauth-steam icon indicating copy to clipboard operation
omniauth-steam copied to clipboard

Oauth broken with latest steam updated

Open bfosberry opened this issue 10 years ago • 11 comments

Hi, getting a weird issue with steam oauth now:

2014-04-09T16:18:47.836005+00:00 app[web.1]: NoMethodError (undefined method `[]' for nil:NilClass):
2014-04-09T16:18:47.836196+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/omniauth-steam-1.0.3/lib/omniauth/strategies/steam.rb:39:in `player'
2014-04-09T16:18:47.836196+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/omniauth-steam-1.0.3/lib/omniauth/strategies/steam.rb:17:in `block in <class:Steam>'
2014-04-09T16:18:47.836196+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/omniauth-1.2.1/lib/omniauth/strategy.rb:105:in `instance_eval'
2014-04-09T16:18:47.836196+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/omniauth-1.2.1/lib/omniauth/strategy.rb:105:in `block in compile_stack'
2014-04-09T16:18:47.836196+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/omniauth-1.2.1/lib/omniauth/strategy.rb:104:in `each'
2014-04-09T16:18:47.836196+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/omniauth-1.2.1/lib/omniauth/strategy.rb:104:in `inject'
2014-04-09T16:18:47.836196+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/omniauth-1.2.1/lib/omniauth/strategy.rb:104:in `compile_stack'
2014-04-09T16:18:47.836196+00:00 app[web.1]:   (eval):7:in `info_stack'
2014-04-09T16:18:47.836196+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/omniauth-1.2.1/lib/omniauth/strategy.rb:321:in `info'
2014-04-09T16:18:47.836196+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/omniauth-1.2.1/lib/omniauth/strategy.rb:334:in `auth_hash'
2014-04-09T16:18:47.836698+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/omniauth-1.2.1/lib/omniauth/strategy.rb:361:in `callback_phase'
2014-04-09T16:18:47.836698+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/omniauth-openid-1.0.1/lib/omniauth/strategies/open_id.rb:81:in `callback_phase'
2014-04-09T16:18:47.836698+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/omniauth-1.2.1/lib/omniauth/strategy.rb:227:in `callback_call'
2014-04-09T16:18:47.836698+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/omniauth-1.2.1/lib/omniauth/strategy.rb:184:in `call!'
2014-04-09T16:18:47.837360+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/content_length.rb:14:in `call'
2014-04-09T16:18:47.837360+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service'
2014-04-09T16:18:47.837360+00:00 app[web.1]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
2014-04-09T16:18:47.836698+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/omniauth-1.2.1/lib/omniauth/strategy.rb:164:in `call'
2014-04-09T16:18:47.836698+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/omniauth-1.2.1/lib/omniauth/builder.rb:59:in `call'
2014-04-09T16:18:47.836698+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/etag.rb:23:in `call'
2014-04-09T16:18:47.836698+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/conditionalget.rb:25:in `call'
2014-04-09T16:18:47.836698+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/head.rb:11:in `call'
2014-04-09T16:18:47.836698+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/params_parser.rb:27:in `call'
2014-04-09T16:18:47.836875+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/flash.rb:241:in `call'
2014-04-09T16:18:47.836875+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/session/abstract/id.rb:225:in `context'
2014-04-09T16:18:47.836875+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/session/abstract/id.rb:220:in `call'
2014-04-09T16:18:47.836875+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/cookies.rb:486:in `call'
2014-04-09T16:18:47.836875+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/query_cache.rb:36:in `call'
2014-04-09T16:18:47.836875+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:626:in `call'
2014-04-09T16:18:47.836875+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
2014-04-09T16:18:47.836875+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/callbacks.rb:373:in `_run__4175763039186087722__call__callbacks'
2014-04-09T16:18:47.836875+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/callbacks.rb:80:in `run_callbacks'
2014-04-09T16:18:47.836875+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
2014-04-09T16:18:47.837188+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
2014-04-09T16:18:47.837188+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
2014-04-09T16:18:47.837188+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
2014-04-09T16:18:47.837188+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/rack/logger.rb:38:in `call_app'
2014-04-09T16:18:47.837188+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/rack/logger.rb:21:in `block in call'
2014-04-09T16:18:47.837188+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/tagged_logging.rb:67:in `block in tagged'
2014-04-09T16:18:47.837188+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/tagged_logging.rb:25:in `tagged'
2014-04-09T16:18:47.837188+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/tagged_logging.rb:67:in `tagged'
2014-04-09T16:18:47.837188+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/rack/logger.rb:21:in `call'
2014-04-09T16:18:47.837188+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/request_id.rb:21:in `call'
2014-04-09T16:18:47.837360+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/methodoverride.rb:21:in `call'
2014-04-09T16:18:47.837360+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/runtime.rb:17:in `call'
2014-04-09T16:18:47.837360+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/cache/strategy/local_cache.rb:83:in `call'
2014-04-09T16:18:47.837360+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/actionpack-4.0.0/lib/action_dispatch/middleware/static.rb:64:in `call'
2014-04-09T16:18:47.837360+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/engine.rb:511:in `call'
2014-04-09T16:18:47.837360+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/railties-4.0.0/lib/rails/application.rb:97:in `call'
2014-04-09T16:18:47.837360+00:00 app[web.1]:   vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/lock.rb:17:in `call'
2014-04-09T16:18:47.837702+00:00 app[web.1]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
2014-04-09T16:18:47.837702+00:00 app[web.1]:   vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'

thought it was an issue with my code at first, but I'm guessing its something related to steam changing the way data is sent

bfosberry avatar Apr 10 '14 13:04 bfosberry

I think we need to do a nil check before here on player

https://github.com/reu/omniauth-steam/blob/master/lib/omniauth/strategies/steam.rb#L15

That would stop the exceptions, at least in this part of the code, not sure why player is no longer available though.

bfosberry avatar Apr 10 '14 13:04 bfosberry

2014-04-10T14:01:25.832334+00:00 app[web.1]: I, [2014-04-10T14:01:25.832215 #2] INFO -- OpenID: Generated checkid_setup request to https://steamcommunity.com/openid/login using stateless mode. 2014-04-10T14:01:25.831037+00:00 app[web.1]: I, [2014-04-10T14:01:25.830826 #2] INFO -- OpenID: Missing required parameter in response from https://steamcommunity.com/openid/login: http://specs.openid.net/auth/2.0assoc_type not in this message 2014-04-10T14:01:34.090563+00:00 app[web.1]: I, [2014-04-10T14:01:34.090436 #2] INFO -- OpenID: Error attempting to use stored discovery information: OpenID::TypeURIMismatch 2014-04-10T14:01:34.090563+00:00 app[web.1]: I, [2014-04-10T14:01:34.090514 #2] INFO -- OpenID: Attempting discovery to verify endpoint 2014-04-10T14:01:34.090650+00:00 app[web.1]: I, [2014-04-10T14:01:34.090575 #2] INFO -- OpenID: Performing discovery on http://steamcommunity.com/openid/id/76561197969821549 2014-04-10T14:01:34.742281+00:00 app[web.1]: I, [2014-04-10T14:01:34.742125 #2] INFO -- OpenID: Using 'check_authentication' with https://steamcommunity.com/openid/login 2014-04-10T14:01:34.742948+00:00 app[web.1]: I, [2014-04-10T14:01:34.742852 #2] INFO -- OpenID: WARNING: making https request to https://steamcommunity.com/openid/login without verifying server certificate; no CA path was specified.

bfosberry avatar Apr 10 '14 14:04 bfosberry

I think this was mostly caused by nil env args on my part and callback code bugs, but you may want to look into making this less brittle. Nothing urgent though

bfosberry avatar Apr 11 '14 02:04 bfosberry

How did you get around this? Currently getting same error.

EDIT: So this was my bad. I wasn't loading the Steam web api key properly. Could probably do with some better error than NoMethodError but like the above said, nothing urgent.

RossBarnie avatar Aug 06 '14 19:08 RossBarnie

@bfosberry I'm getting the same error as you, what did you do so it would work properly?

ashea-code avatar Dec 11 '14 21:12 ashea-code

As Ross mentioned, just write some debugging code or hop on the console and ensure your web api key is being loaded correctly

bfosberry avatar Dec 12 '14 15:12 bfosberry

The way I solved it was using rails secrets.yml file to load the API key from an environment variable then used the following in config/initializers/omniauth.rb:

require "omniauth/strategies/steam"
require "openid/store/filesystem"

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :steam, Rails.application.secrets.steam_web_api_key, :storage => OpenID::Store::Filesystem.new("/tmp")
end

RossBarnie avatar Dec 20 '14 23:12 RossBarnie

Just wanted to say I had this same issue and my problem was I had added the provider in both my devise.rb intializer and in an omniauth initializer, when I removed my omniauth initializer it solved the issue. So if you are using devise + omniauth that's probably why!

mvarrieur avatar Mar 21 '15 22:03 mvarrieur

Got the same error. Turns out that I forgot to set the env variable.

ghost avatar Apr 29 '15 05:04 ghost

Hello bfosberry . would you mind tell me how do you write the debug code?

roccia avatar Oct 01 '15 23:10 roccia

On your inbound controller just puts out params and look at the returned values, and errors. You can also use a standard debugger and take a look at the response. Also be sure to verify all your configuration values are being loaded correctly from your omniauth yml

bfosberry avatar Oct 02 '15 15:10 bfosberry