Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Migrate to OAuth2 for Facebook

  • Loading branch information...
commit 51516290788fe68b672c08138a17d98d94da5e3c 1 parent 28e3d40
@timdream authored
Showing with 15 additions and 13 deletions.
  1. +8 −7 tests/jquery.getcontent.html
  2. +7 −6 wordcloud.js
View
15 tests/jquery.getcontent.html
@@ -107,6 +107,7 @@
}
FB.init({
+ oauth: true,
appId : FB_app_id,
status: true,
cookie: true,
@@ -210,7 +211,7 @@
'submit',
function () {
FB.getLoginStatus(function(response) {
- if(response.session) {
+ if(response.authResponse) {
test_facebook(response);
} else {
FB.login(
@@ -220,7 +221,7 @@
}
},
{
- perms:'read_stream'
+ scope:'read_stream'
}
);
}
@@ -232,14 +233,14 @@
function test_facebook(response) {
try {
$.getContent(
- response.session.uid,
+ response.authResponse.userID,
{
type: 'facebook',
beforeComplete: beforeComplete,
complete: complete
}
);
- } catch (e) {error(e); }
+ } catch (e) {error(e); return;}
start();
return false;
};
@@ -248,17 +249,17 @@
'submit',
function () {
FB.getLoginStatus(function(response) {
- if(response.session) {
+ if(response.authResponse) {
test_facebook_id();
} else {
FB.login(
function(response) {
- if (response) {
+ if (response.authResponse) {
test_facebook_id();
}
},
{
- perms:'read_stream'
+ scope:'read_stream'
}
);
}
View
13 wordcloud.js
@@ -307,6 +307,7 @@ jQuery(function ($) {
if (FB) {
FB.init({
+ oauth: true,
appId : FB_app_id,
status: true,
cookie: true,
@@ -355,14 +356,14 @@ jQuery(function ($) {
);
// sharer
-
+
$('#interactive .facebook').bind(
'click',
function (ev) {
ev.preventDefault();
FB.login( // call login no matter connected or not, make sure we logged in.
function(response) {
- if (response.session) {
+ if (response.authResponse) {
FB.ui(
{
method: 'feed',
@@ -444,7 +445,7 @@ jQuery(function ($) {
if (type === "fbok" && FB) {
FB.getLoginStatus(function(response) {
- if (response.session) {
+ if (response.authResponse) {
getFbUser();
}
else {
@@ -515,7 +516,7 @@ jQuery(function ($) {
case 'file':
if (!$('#file')[0].files.length) return false;
window.location.hash = '#file';
- break;
+ break;
case 'wiki':
if (!$('#wikipedia_entry').val()) return false;
window.location.hash = '#html:' + 'http://zh.wikipedia.org/zh-tw/' + $('#wikipedia_entry').val();
@@ -663,12 +664,12 @@ jQuery(function ($) {
$('#fbok_entry').html("<p>" + t('fbNeedLogin') + "</p>");
$('#fb_login').click(function(event) {
FB.login(function(response) {
- if (response.session) {
+ if (response.authResponse) {
getFbUser();
}
else {
}
- }, {perms:'read_stream'});
+ }, {scope:'read_stream'});
});
};
Please sign in to comment.
Something went wrong with that request. Please try again.