Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function statusChangeCallback(response) {
- console.log('statusChangeCallback');
- console.log(response);
- if(response.status === 'connected') {
- fbAccessToken = response.authResponse;
- testAPI();
- }
- else if (response.status === 'not_authorized') {
- console.log('not authorised');
- }
- else {
- console.log('not logged in');
- }
- }
- function checkLoginState() {
- FB.getLoginStatus(function(response) {
- statusChangeCallback(response);
- //- var uid = response.authResponse.userID;
- //- var accessToken = response.authResponse.accessToken;
- //- console.log(uid, accessToken);
- });
- }
- window.fbAsyncInit = function() {
- FB.init({
- appId : 'APPID',
- cookie : true, // enable cookies to allow the server to access
- // the session
- xfbml : true, // parse social plugins on this page
- version : 'v2.5' // use version 2.2
- });
- };
- // Load the SDK asynchronously
- (function(d, s, id) {
- var js, fjs = d.getElementsByTagName(s)[0];
- if (d.getElementById(id)) return;
- js = d.createElement(s); js.id = id;
- js.src = "//connect.facebook.net/en_US/sdk.js";
- fjs.parentNode.insertBefore(js, fjs);
- }(document, 'script', 'facebook-jssdk'));
- // Here we run a very simple test of the Graph API after login is
- // successful. See statusChangeCallback() for when this call is made.
- function testAPI() {
- $('.login-using-fb').hide();
- $('.entr-mobile-nmbr ').show();
- $('.mobile-verification').slideDown(300);
- //- $thisParent.next().slideDown(300);
- $('.prsnl-submit-button, .loggedin-usr, .loggedin-usr-dtl').show();
- console.log('Welcome! Fetching your information.... ');
- FB.api('/me', function(response) {
- console.log(response);
- console.log('Successful login for: ' + response.name);
- });
- }
- fb:login-button(onlogin="checkLoginState();") Connect with Facebook
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement