Advertisement
Guest User

Untitled

a guest
Feb 10th, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. function statusChangeCallback(response) {
  2. console.log('statusChangeCallback');
  3. console.log(response);
  4.  
  5. if(response.status === 'connected') {
  6. fbAccessToken = response.authResponse;
  7. testAPI();
  8. }
  9. else if (response.status === 'not_authorized') {
  10.  
  11. console.log('not authorised');
  12. }
  13. else {
  14.  
  15. console.log('not logged in');
  16. }
  17.  
  18. }
  19.  
  20. function checkLoginState() {
  21.  
  22. FB.getLoginStatus(function(response) {
  23. statusChangeCallback(response);
  24. //- var uid = response.authResponse.userID;
  25. //- var accessToken = response.authResponse.accessToken;
  26. //- console.log(uid, accessToken);
  27. });
  28.  
  29. }
  30.  
  31. window.fbAsyncInit = function() {
  32. FB.init({
  33. appId : 'APPID',
  34.  
  35. cookie : true, // enable cookies to allow the server to access
  36. // the session
  37. xfbml : true, // parse social plugins on this page
  38. version : 'v2.5' // use version 2.2
  39. });
  40.  
  41.  
  42.  
  43. };
  44.  
  45. // Load the SDK asynchronously
  46. (function(d, s, id) {
  47. var js, fjs = d.getElementsByTagName(s)[0];
  48. if (d.getElementById(id)) return;
  49. js = d.createElement(s); js.id = id;
  50. js.src = "//connect.facebook.net/en_US/sdk.js";
  51. fjs.parentNode.insertBefore(js, fjs);
  52. }(document, 'script', 'facebook-jssdk'));
  53.  
  54. // Here we run a very simple test of the Graph API after login is
  55. // successful. See statusChangeCallback() for when this call is made.
  56. function testAPI() {
  57. $('.login-using-fb').hide();
  58. $('.entr-mobile-nmbr ').show();
  59. $('.mobile-verification').slideDown(300);
  60. //- $thisParent.next().slideDown(300);
  61.  
  62. $('.prsnl-submit-button, .loggedin-usr, .loggedin-usr-dtl').show();
  63. console.log('Welcome! Fetching your information.... ');
  64. FB.api('/me', function(response) {
  65. console.log(response);
  66. console.log('Successful login for: ' + response.name);
  67. });
  68. }
  69.  
  70. fb:login-button(onlogin="checkLoginState();") Connect with Facebook
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement