omniauth-facebook cannnot get email address

为君一笑 提交于 2019-12-03 07:29:11

I found the way to get email address myself.

https://developers.facebook.com/docs/apps/changelog#v2_4

This doc says that

Declarative Fields To try to improve performance on mobile networks, Nodes and Edges in v2.4 requires that you explicitly request the field(s) you need for your GET requests. For example, GET /v2.4/me/feed no longer includes likes and comments by default, but GET /v2.4/me/feed?fields=comments,likes will return the data. For more details see the docs on how to request specific fields.

so, it need to write in config/initializers/devise.rb

  config.omniauth :facebook, 'app_id', 'app_secret',  scope: 'email', info_fields: 'email'
  • scope: 'email' is default

not only scope, but also info_fields.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!