| <!DOCTYPE html> |
| <html> |
| <head> |
| <title>Facebook Login JavaScript Example</title> |
| <meta charset="UTF-8"> |
| </head> |
| <body> |
| HEY |
| <script> |
| function statusChangeCallback(response) { |
| console.log('statusChangeCallback'); |
| console.log(response); |
| if (response.status === 'connected') { |
| testAPI(); |
| } else { |
| document.getElementById('status').innerHTML = 'Please log ' + |
| 'into this webpage.'; |
| } |
| } |
| function checkLoginState() { |
| FB.getLoginStatus(function(response) { |
| statusChangeCallback(response); |
| }); |
| console.log("TEST 123"); |
| FB.login(function(response) { |
| |
| console.log("HURRRAY SUCCESS!!"); |
| }, {scope: 'public_profile,email'}); |
| } |
| window.fbAsyncInit = function() { |
| FB.init({ |
| appId : '1066512588151225', |
| cookie : true, |
| xfbml : true, |
| version : 'v21.0' |
| }); |
| FB.getLoginStatus(function(response) { |
| statusChangeCallback(response); |
| }); |
| }; |
| |
| function testAPI() { |
| 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 + '!'; |
| }); |
| } |
| </script> |
|
|
|
|
| |
|
|
| <fb:login-button |
| scope="public_profile,email" |
| onlogin="checkLoginState();" |
| config_id="1262271834866947"> |
| </fb:login-button> |
|
|
| <div id="status"> |
| </div> |
|
|
| |
| |
| <script async defer crossorigin="anonymous" src="https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v21.0&appId=1066512588151225"></script> |
| |
| </body> |
| </html> |