使用Omniauth和facebook API 2.4不会返回电子邮件,性别,年龄

时间:2015-07-27 00:30:21

标签: facebook devise omniauth omniauth-facebook

我可以使用Omniauth取回电子邮件信息。

我认为问题在于API 2.4,

但我不知道我怎么能得到预期的信息

设计配置

config.omniauth :facebook, ENV['FACEBOOK_KEY'], ENV['FACEBOOK_SECRET'], {
  :scope => 'email',
  :info_fields => 'id,email,gender,link,locale,name,timezone,updated_time,verified',
  strategy_class: OmniAuth::Strategies::Facebook,
  :provider_ignores_state => true}

不包含电子邮件信息的返回信息

:1> env['omniauth.auth']
{
       "provider" => "facebook",
            "uid" => "xxxx",
           "info" => {
         "name" => "Eric Hsu",
        "image" => "http://graph.facebook.com/xxxx/picture?type=square"
    },
    "credentials" => {
             "token" => "CAAh",
        "expires_at" => 1443066205,
           "expires" => true
    },
          "extra" => {
        "raw_info" => {
            "name" => "Eric Hsu",
              "id" => "xxxx"
        }
    }
}

1 个答案:

答案 0 :(得分:0)

我发现问题是FB API和omniauth-facebook版本之间的依赖关系。 当前我安装了gem omniauth-facebook (2.0.1)