简体   繁体   中英

devise+omniauth-facebook, where can I find the auth hash?

I need to change the image size, so where can I find that hash that contains all the info returned? I am using devise Thanks

auth hash is stored in env["omniauth.auth"] , look for it in your callback controller

data = request.env["omniauth.auth"]

this data contains all your info. Facebook provides 4 sizes for image small, square, large, normal . And you can set the default size for image in config/initializers/omniauth.r b as,

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :facebook, ENV['FACEBOOK_KEY'], ENV['FACEBOOK_SECRET'], :image_size => 'large'
end

Update : If you are using devise, check in your app/config/initializers/devise.rb

 Devise.setup do |config|
...
  config.omniauth :facebook,  ENV['FACEBOOK_KEY'], ENV['FACEBOOK_SECRET'], :image_size => 'large'
...
end

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM