Migrating Facebook apps to Open Graph 2.0

Lately I got a message from Facebook about upgrading of our Facebook apps to OpenGraph2:

We have 3 apps – 2 web applications which used Facebook Javascript SDK and Facebook connect app. Let’s see what’s need to be done to upgrade web apps to latest Open Graph and javascript SDK, also forgot to say That I don’t need to submit to login review, cause apps using standard permissions – public_profile, email, user_friends.

Update web apps

Updating reference to Facebook javascript SDK:

before:

1
  '//connect.facebook.net/en_US/all.js'

after:

1
  '//connect.facebook.net/en_US/sdk.js'

Add version 2.0 explicitly:

before:

1
  FB.init({appId: app_id, status: true, cookie: true});

after:

1
  FB.init({appId: app_id, status: true, cookie: true, version: 'v2.0'});

Update facebook connect

For facebook connect we using ‘omniauth-facebook’ gem. To update gem to latest open graph version you need to make changes in your configuration by adding :site => ‘facebook/opengraph2/2.0’ to ‘client_options’.

config/initializers/omniauth.rb:

1
2
3
4
Rails.application.config.middleware.use OmniAuth::Builder do
  provider :facebook, 'facebook_login', 'facebook_secret',
    {:client_options => {:site => 'https://graph.facebook.com/v2.0'}}
end

You may test all changes in your app before deploying to production by turning all flags on in settings/migration tab.

Comments