Advertisement
Guest User

Untitled

a guest
Feb 6th, 2016
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.79 KB | None | 0 0
  1. <p><a onclick='login(); return false;'>Login</a></p>
  2. <script>
  3.  
  4. // Additional JS functions here
  5. window.fbAsyncInit = function() {
  6. FB.init({
  7. appId : '3423243443', // App ID
  8. status: true, // check login status
  9. cookie: true, // enable cookies to allow server to access session,
  10. xfbml: true, // enable XFBML and social plugins
  11. oauth: true // enable OAuth 2.0
  12. // channelUrl: 'http://www.yourdomain.com/channel.html' //custom channel
  13. });
  14. FB.getLoginStatus(function(response) {
  15. if (response.status === 'connected') {
  16. // connected
  17. alert("connected1"+response.authResponse.expiresIn);
  18.  
  19. } else if (response.status === 'not_authorized') {
  20. // not_authorized
  21. login();
  22. } else {
  23. // not_logged_in
  24. alert("not logged in");
  25. login();
  26. }
  27. },true);
  28.  
  29.  
  30.  
  31. };
  32.  
  33.  
  34. (function(d){
  35. var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
  36. if (d.getElementById(id)) {return;}
  37. js = d.createElement('script'); js.id = id; js.async = true;
  38. js.src = "//connect.facebook.net/en_US/all.js";
  39. ref.parentNode.insertBefore(js, ref);
  40. }(document));
  41.  
  42. /*function login() {
  43. FB.login(function(response) {
  44. if (response.authResponse) {
  45. testAPI(response)
  46. // connected
  47. alert("connected2 "+response.authResponse);
  48. } else {
  49. // cancelled
  50. alert("cancelled");
  51. alert("cancelled"+response.authResponse);
  52. }
  53. });
  54. } ;
  55.  
  56. function testAPI() {
  57. console.log('Welcome! Fetching your information.... ');
  58. FB.api('/me', function(response) {
  59. console.log('Good to see you, ' + response.email + '.');
  60. });
  61. } ;*/
  62.  
  63.  
  64. </script>
  65.  
  66. window.fbAsyncInit = function() {
  67.  
  68. FB.init({
  69. appId : '228947400773762',
  70. status : false,
  71. cookie : true,
  72. xfbml : true,
  73. version : 'v2.2'
  74. });
  75.  
  76. jQuery('#signUpWithFacebookButtonId').click(function(){
  77. FB.login(function(response) {
  78. if (response.status === 'connected') {
  79. console.log('Logged into your app and Facebook.');
  80. } else if (response.status === 'not_authorized') {
  81. console.log('The person is logged into Facebook, but not your app.');
  82. } else {
  83. console.log('The person is not logged into Facebook, so we are not sure if they are logged into this app or not.');
  84. }
  85. }, {scope: 'public_profile, email'});
  86. });
  87.  
  88. };//end window.fbAsyncInit function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement