这是在omniauth.rb 中编写的一个初始化程序。
Rails.application.config.middleware.use OmniAuth::Builder do
provider :google_oauth2,ID,SECRET,
{
:approval_prompt => '',
:scope => 'http://gdata.youtube.com,https://www.googleapis.com/auth/userinfo.email,https://www.googleapis.com/auth/userinfo.profile'
}
返回的身份验证哈希在“信息”中没有 IMAGE 元素,为什么?????????
在下面的 HASH 中用 x 替换了原始信息
*********************
--- !ruby/hash:OmniAuth::AuthHash
provider: google_oauth2
uid: 'xxxxxxxxxxxxxxxxxxxx'
info: !ruby/hash:OmniAuth::AuthHash::InfoHash
name: xxxx xxx
email: xxxxxxxxxx
first_name: xxxxxx
last_name: xxxxxxx
credentials: !ruby/hash:Hashie::Mash
token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
expires_at: 1365434778
expires: true
extra: !ruby/hash:Hashie::Mash
raw_info: !ruby/hash:Hashie::Mash
id: 'xxxxxxxxxxxxxxxxxxxxxxxxxxx'
email: xxxxxxxxxx.xxx@gmail.com
verified_email: true
name: xxxx xxxx
given_name: xxx
family_name: xxx
link: https://plus.google.com/xxxxxxxxxxx
gender: male
locale: en
*********************
我想要个人资料图片,我做错了什么?
也试过,
{:scope => 'userinfo.email,userinfo.profile'}
不工作!