omniauth-google-apps icon indicating copy to clipboard operation
omniauth-google-apps copied to clipboard

"undefined method `uses_extension' for ..."

Open beseku opened this issue 11 years ago • 6 comments

When the Rails application receives the callback the above error is generated. No idea why.

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :google_apps, domain: 'http://domain.com'  
end

beseku avatar Jun 24 '14 10:06 beseku

Try removing the http://

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :google_apps, domain: 'domain.com'  
end

robinson-spai avatar Jul 10 '14 14:07 robinson-spai

I am experiencing the same issue with one of my applications.

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :google_apps, domain: 'domain.com'
end

undefined method `uses_extension' for #String:0x007fa5f3cf6d18

block in verify_discovery_singleruby-openid (2.3.0) lib/openid/consumer/idres.rb line 464

if !endpoint.uses_extension(type_uri)

endpoint is a string.

>> endpoint
=> "<OpenID::OpenIDServiceEndpoint server_url=https://www.google.com/a/domain.com/o8/ud?be=o8 claimed_id= local_id= canonical_id= used_yadis=true>"
>> endpoint.class
=> String

Here is a list of possibly relevant gems.

  • omniauth (1.2.2)
  • omniauth-google-apps (0.1.0)
  • omniauth-openid (1.0.1)
  • ruby-openid (2.3.0)
  • ruby-openid-apps-discovery (1.2.0)

Any suggestions to troubleshoot this would greatly be appreciated.

ttdonovan avatar Aug 06 '14 19:08 ttdonovan

After some digging into ruby-openid it appears that the issues is with the OpenID::Consumer class with setting and getting of values from the ActionDispatch::Request::Session. The method last_requested_endpoint is returning the a string value of the Ruby object instead of the actual object.

At this point I'm not sure is this is an ActionDispatch or OpenID issue.

ttdonovan avatar Aug 06 '14 21:08 ttdonovan

The issues appears to be with Rails 4.1 and OpenID, see this issue thread for a possible resolution https://github.com/openid/ruby-openid/issues/75.

Rails.application.config.action_dispatch.cookies_serializer = :marshal

ttdonovan avatar Aug 06 '14 22:08 ttdonovan

@ttdonovan Thank you for the info. Can you attach your whole Gemfile.lock, I'll take a dig. Thank you.

sishen avatar Aug 07 '14 02:08 sishen

@sishen I've included a link to a copy of my Gemfile.lock.

https://gist.github.com/ttdonovan/eee3d83468fad2018130#file-gemfile-lock

I feel the issue resides in the ruby-openid gem with Rails 4. Even in the upgrade Rails guide there is a call out about serializing objects in the session.

When using the :json or :hybrid serializer, you should beware that not all Ruby objects can be serialized as JSON. For example, Date and Time objects will be serialized as strings, and Hashes will have their keys stringified.

http://guides.rubyonrails.org/upgrading_ruby_on_rails.html#cookies-serializer

ttdonovan avatar Aug 07 '14 03:08 ttdonovan