omniauth-facebook cannnot get email address

后端 未结 1 421
暖寄归人
暖寄归人 2021-02-08 15:12

I created new Rails App and install Devise and omniauth-facebook gem.

And setting my Facebook App, as testing environment.

So, I logged in via facebook and signe

相关标签:
1条回答
  • 2021-02-08 16:10

    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.

    0 讨论(0)
提交回复
热议问题