From a27cad5d101a0031c7cb5a785e8e40c3f163074b Mon Sep 17 00:00:00 2001 From: fengyuexingzi Date: Sat, 16 Jun 2018 08:49:47 +0800 Subject: [PATCH] facebook --- auth/facebook/index.php | 132 ++++++++++----------------------------- auth/facebook/login.html | 15 +++-- 2 files changed, 39 insertions(+), 108 deletions(-) diff --git a/auth/facebook/index.php b/auth/facebook/index.php index 743e621..0df0dc8 100644 --- a/auth/facebook/index.php +++ b/auth/facebook/index.php @@ -6,104 +6,36 @@ * Time: 10:00 */ -$html = << - - - Facebook Login JavaScript Example - - - - - - - - - - -
-
- - - -EOF; - -echo $html; \ No newline at end of file diff --git a/auth/facebook/login.html b/auth/facebook/login.html index ae8fccf..ac0d75a 100644 --- a/auth/facebook/login.html +++ b/auth/facebook/login.html @@ -21,6 +21,7 @@ $.getScript('https://connect.facebook.net/en_US/sdk.js', function () { FB.init({ appId: '176954776322838', + cookie: true, version: 'v3.0' }); }); @@ -31,12 +32,12 @@ FB.getLoginStatus(function (response) { if (response.status === 'connected') { console.log(response); - // fbCallInfo(response); + fbCallInfo(); } else { FB.login(function (response) { - if (response.status === 'connected'){ + if (response.status === 'connected') { console.log(response); - // fbCallInfo(response); + fbCallInfo(); } }, {scope: 'public_profile,email'}); } @@ -57,13 +58,11 @@ } // send info to server - function fbCallInfo(response) { + function fbCallInfo() { $.ajax({ - url: '', + url: 'https://fengyuexingzi.top/auth/facebook/index.php', type: 'post', - ContentType: 'json', - data: response, - dateTyep: 'json', + data: '', success: function (data, status) { if (status == 'success') { console.log(data);