3

We just updated our ruby version to 2.0 from 1.9.3. From what I can tell we haven't updated omniauth omniauth-facebook or oauth in the upgrade. The upgrade however broke facebook login. Looking at the logs I don't see an email coming back in the omniauth hash.

Here's my initializer, which loads my yml file where I define the secret and whatnot.

omniauth.rb initializer class OmniAuthConfig class << self def load(file = 'omniauth.yml') configuration_file = File.join(Rails.root, 'config', file)

      if File.exists?(configuration_file)
        File.open(configuration_file) do |configuration|
          configuration = YAML.load(configuration)[Rails.env.to_sym]

          configuration.each do |key, value|
            cattr_accessor(key)
            send("#{key}=", value)
          end
        end
      end
    end
  end
end

OmniAuthConfig.load

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :facebook,
           OmniAuthConfig.facebook_api_key,
           OmniAuthConfig.facebook_api_secret,
           scope: 'email',
           client_options: { ssl: { ca_file: "/etc/ssl/certs/ca-certificates.crt" } }
end

Censored logs:

--- !ruby/hash:OmniAuth::AuthHash
provider: facebook
uid: 
info: !ruby/hash:OmniAuth::AuthHash::InfoHash
  image: http://graph.facebook.com//picture?type=square
credentials: !ruby/hash:OmniAuth::AuthHash
  token: HUGE_TOKEN_STRING
  expires_at: 1485547306
  expires: true
extra: !ruby/hash:OmniAuth::AuthHash
  raw_info: !binary |-
    HASH_THINGY
jahrichie
  • 1,215
  • 3
  • 17
  • 26

0 Answers0