Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <p><a onclick='login(); return false;'>Login</a></p>
- <script>
- // Additional JS functions here
- window.fbAsyncInit = function() {
- FB.init({
- appId : '3423243443', // App ID
- status: true, // check login status
- cookie: true, // enable cookies to allow server to access session,
- xfbml: true, // enable XFBML and social plugins
- oauth: true // enable OAuth 2.0
- // channelUrl: 'http://www.yourdomain.com/channel.html' //custom channel
- });
- FB.getLoginStatus(function(response) {
- if (response.status === 'connected') {
- // connected
- alert("connected1"+response.authResponse.expiresIn);
- } else if (response.status === 'not_authorized') {
- // not_authorized
- login();
- } else {
- // not_logged_in
- alert("not logged in");
- login();
- }
- },true);
- };
- (function(d){
- var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
- if (d.getElementById(id)) {return;}
- js = d.createElement('script'); js.id = id; js.async = true;
- js.src = "//connect.facebook.net/en_US/all.js";
- ref.parentNode.insertBefore(js, ref);
- }(document));
- /*function login() {
- FB.login(function(response) {
- if (response.authResponse) {
- testAPI(response)
- // connected
- alert("connected2 "+response.authResponse);
- } else {
- // cancelled
- alert("cancelled");
- alert("cancelled"+response.authResponse);
- }
- });
- } ;
- function testAPI() {
- console.log('Welcome! Fetching your information.... ');
- FB.api('/me', function(response) {
- console.log('Good to see you, ' + response.email + '.');
- });
- } ;*/
- </script>
- window.fbAsyncInit = function() {
- FB.init({
- appId : '228947400773762',
- status : false,
- cookie : true,
- xfbml : true,
- version : 'v2.2'
- });
- jQuery('#signUpWithFacebookButtonId').click(function(){
- FB.login(function(response) {
- if (response.status === 'connected') {
- console.log('Logged into your app and Facebook.');
- } else if (response.status === 'not_authorized') {
- console.log('The person is logged into Facebook, but not your app.');
- } else {
- console.log('The person is not logged into Facebook, so we are not sure if they are logged into this app or not.');
- }
- }, {scope: 'public_profile, email'});
- });
- };//end window.fbAsyncInit function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement