Skip to content
This repository has been archived by the owner on Nov 8, 2021. It is now read-only.

Migration

benorama edited this page Sep 29, 2011 · 27 revisions

Home | Installation | Migration | Usage | Examples

This page describes how to migrate from V2.* to V3.* of Facebook ColdFusion SDK.

OAuth 2.0 and HTTPS Migration: October 1st Deadline

As explained in Facebook Platform Roadmap, by October 1, 2011:

  • all Website and Canvas apps must exclusively support OAuth 2.0 (draft 20),
  • all Canvas Apps must use the signed_request parameter,
  • an SSL Certificate is required for all Canvas and Page Tab apps (not in Sandbox mode),
  • old, previous versions of our SDKs will stop working, including the old JavaScript SDK, old iOS SDK.

How to migrate to OAuth 2.0

You can ensure that you have migrated by:

1. Using the latest Facebook ColdFusion SDK

Latest Facebook ColdFusion SDK support OAuth 2.0 Facebook implementation and HTTPS. It is a major rewrite of the SDK, based on official PHP SDK V3.1.1.

Important changes to note:

  • session managment must be enabled in your ColdFusion application,
  • when creating an instance of the FacebookGraphAPI.cfc and FacebookRestAPI.cfc, you can pass an appId parameter (it is used to automatically invalidate current user session if user access token becomes invalid, for example if the user log out from Facebook.com).

The following method has been REMOVED from FacebookApp.cfc:

  • getUserSession(), you must only use getUserId() to check if user is authenticated

The following methods have been RENAMED in FacebookGraphAPI.cfc:

  • createSubscription() -> createAppSubscription()
  • createTestUser() -> createAppTestUser()
  • createTestUserFriendConnection -> createAppTestUserFriendConnection()
  • deleteSubscription() -> deleteAppSubscription()
  • getSubscriptions() -> getAppSubscriptions()
  • getTestUsers() -> getAppTestUsers()
  • getBlockedUsers() -> getPageBlockedUsers()

The following methods have been ADDED to FacebookGraphAPI.cfc:

  • addPageTab()
  • deletePageTab()
  • getEventUsers()
  • getOAuthAccessToken()
  • getPageAdmins()
  • getPageTab()
  • getPageTabs()
  • hasPageTab()
  • inviteUsersToEvent()
  • isUserAdmin()
  • uninviteUserFromEvent()
  • updatePageTab()

See SDK CFC Documentation for more info.

2. Updating your JavaScript SDK code

If you use the Facebook JavaScript SDK, you must add oauth:true parameter in the SDK initialization to use the latest JavaScript SDK with OAuth 2.0 implementation.

FB.init({
   appId : YOUR_APP_ID,
   // other parameters,
   oauth : true
});

When using FB.login(), you must also rename your callback code from response.session to response.authResponse and the perms parameter is renamed to scope:

FB.login(function(response) {
  if (response.authResponse) {
	// Previously it returned response.session
    console.log("User is connected to the application.");
    var accessToken = response.authResponse.accessToken;
  }
},
scope:"publish_stream");

3. Updating your Facebook app settings

Check your app settings in Developer Apps.

In advanced settings, the following migration must be selected:

  • signed_request for Canvas
  • OAuth 2.0 requests
  • Encrypted Access Token
Clone this wiki locally