簡體   English   中英

Rails,使用omniauth-google-oauth2獲取circledByCount

[英]Rails, get circledByCount with omniauth-google-oauth2

我使用omniauth-google-oauth2 gem,並希望在我的omniauth文件的google plus帳戶上吸引圈子中的所有人:

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :twitter, ENV['twitter_key'], ENV['twitter_secret'], info_fields: 'followers_count'
  provider :instagram, ENV['instagram_key'], ENV['instagram_secret'], info_fields: 'follows'
  provider :facebook, ENV['facebook_key'], ENV['facebook_secret'], info_fields: 'friends'
  google_scope = "plus.login"

  provider :google_oauth2, ENV['google_key'], ENV['google_secret'], scope: google_scope, access_type: "offline"
end

但request.env ['omniauth.auth']返回:

"id_info"=>
{"iss"=>"accounts.google.com",
 "at_hash"=>"secret",
 "aud"=>"secret",
 "sub"=>"secret",
 "azp"=>"secret",
 "iat"=>1445275484,
 "exp"=>1445279084},
"raw_info"=>
{"kind"=>"plus#personOpenIdConnect",
 "gender"=>"male",
 "sub"=>"103458288129240855409",
 "name"=>"Sergey Naumenko",
 "given_name"=>"Sergey",
 "family_name"=>"Naumenko",
 "profile"=>"https://plus.google.com/103458288129240855409",
 "picture"=>"https://lh6.googleusercontent.com/-b8p4jlJRIm8/AAAAAAAAAAI/AAAAAAAAAV4/rZXezwwCy7w/photo.jpg?sz=50",
 "locale"=>"en"}}}

我需要得到circledByCount

誰能幫我?

我通過添加選項skip_friends修復了它:false

provider :google_oauth2, ENV['google_key'], ENV['google_secret'], scope: google_scope, skip_friends: false

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM