Commit 984b4659 by libai

测试

parent e90ba620
Showing with 49 additions and 0 deletions
......@@ -583,4 +583,52 @@ function handleCredentialResponse(response) {
// //console.log('Family Name: ' + responsePayload.family_name);
// //console.log("Image URL: " + responsePayload.picture);
// //console.log("Email: " + responsePayload.email);
}
//facebook
var info;
function statusChangeCallback(response) { // Called with the results from FB.getLoginStatus().
// //console.log('statusChangeCallback');
// //console.log(response); // The current login status of the person.
if (response.status === 'connected') { // Logged into your webpage and Facebook.
info = response
testAPI();
} else { // Not logged into your webpage or we are unable to tell.
// document.getElementById('status').innerHTML = 'Please log ' +
// 'into this webpage.';
}
}
function checkLoginState() { // Called when a person is finished with the Login Button.
FB.getLoginStatus(function (response) { // See the onlogin handler
statusChangeCallback(response);
});
}
window.fbAsyncInit = function () {
FB.init({
appId: '382456482257502',
cookie: true, // Enable cookies to allow the server to access the session.
xfbml: true, // Parse social plugins on this webpage.
version: 'v13.0' // Use this Graph API version for this call.
});
FB.getLoginStatus(function (response) { // Called after the JS SDK has been initialized.
statusChangeCallback(response); // Returns the login status.
});
};
function testAPI() { // Testing Graph API after login. See statusChangeCallback() for when this call is made.
// //console.log('Welcome! Fetching your information.... ');
FB.api('/me', function (response) {
// //console.log('Successful login for: ' + response.name);
// document.getElementById('status').innerHTML =
// 'Thanks for logging in, ' + response.name + '!';
// window.location.href = "footseenlogin://" + encodeURIComponent("www.firefly.live?token=" + info.authResponse.accessToken + "&name=" + response.name + "&id=" + response.id);
});
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment