How to specify facebook graph API version while using devise and omniauth-facebook
Asked Answered
C

1

7

I'm using devise and omniauth-facebook authentication in my rails 4 application.

Facebook has moved on to v2.x graph API. (deadline for api migration is April 30, 2015).

During authentication, facebook's login dialog show the following message

"You must upgrade this app to Graph API v2.x
v1.0 will be deprecated on April 30, 2015
Learn how to upgrade"

I figured this is because omniauth-facebook/devise right now uses facebook graph api v1.x.

How do I configure it to point to v2.x ?

Canfield answered 3/11, 2014 at 3:39 Comment(0)
C
12

Found the solution, hope it helps someone as well

The link is https://github.com/mkdynamic/omniauth-facebook/issues/152

Solution is to configure provider for omniauth-facebook in initializer file as:

 provider :facebook, ENV['APP_ID'], ENV['APP_SECRET'],
    :scope => 'email,read_stream',
    :client_options => {
      :site => 'https://graph.facebook.com/v2.0',
      :authorize_url => "https://www.facebook.com/v2.0/dialog/oauth"
    }
Canfield answered 19/11, 2014 at 11:42 Comment(1)
I don't get it to work or at least I don't see any change, because I still receive the "username" field from the FB API response, and this field is suposed to be removed on API versions >2.0. Any clue on how can I check it for sure if it is making calls to the v2.0 or not?Boracite

© 2022 - 2024 — McMap. All rights reserved.