Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8058579
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T09:24:09+00:00 2026-06-05T09:24:09+00:00

I got a Problem with the Facebook Login on my page. First I tried

  • 0

I got a Problem with the Facebook Login on my page.
First I tried it with only FB.Login but then i get following message: “FB.login() called when user is already connected.”

So I added FB.getLoginStatus But now it keeps loggin me in, in a infinite loop. Even if i’m logged (into my system) and without me clicking on the FB-Connect Button.

How can I achieve it to not log me in until I click the FB-connect Button?

<div id="fb-root"></div>
<script>(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/fb_LT/all.js#xfbml=1&appId=198866780209581";
     fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));

window.fbAsyncInit = function() {
      FB.init({
         appId      : "198866780209581", // App ID
         status     : true,
         cookie     : true,
         xfbml      : true,
         oauth      : true,
      });   
    var login = false;

 FB.getLoginStatus(function(response) {
    if (response.status === 'connected') {
      console.log('connected');
      login=true;
      $.ajax({
              type: "POST",
              url: "/?eID=login&modus=facebook&fb-login=1",
              data: $(this).serialize(),
              success: function(msg) {
              console.log("LOGIN");
              window.location.reload();
              }
            })
      var uid = response.authResponse.userID;
      var accessToken = response.authResponse.accessToken;
    }
    else{
      FB.login(function(response) {
       if (response.authResponse) {
       console.log('Welcome!  Fetching your information.... ');
       FB.api('/me', function(response) {
         console.log('Good to see you, ' + response.name + '.');
         if(login===false)
         {
           alert('nicht connected');
         }
       });
       } else {
       console.log('User cancelled login or did not fully authorize.');
       }   
     }, {scope: 'email'});
    }});
// Additional initialization code here
};

</script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T09:24:12+00:00Added an answer on June 5, 2026 at 9:24 am

    The solution was to change the click function like this:

    $(“.fb-login-button”).live(“click”, function() {

    }

    My final code looks like this:

    <div id="fb-root"></div>
    <script>(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/fb_LT/all.js#xfbml=1&appId=198866780209581";
      fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));
    window.fbAsyncInit = function() {
        FB.init({
          appId      : "198866780209581", // App ID
          status     : true,
          cookie     : true,
          xfbml      : true,
          oauth      : true,
        });   
        var login = false;
      $(".fb-login-button").live("click", function() {
    FB.getLoginStatus(function(response) {
     alert('hier 1');
        if (response.status === 'connected') {
     alert('connected');
          console.log('connected');
          login=true;
          $.ajax({
                  type: "POST",
                  url: "/?eID=login&modus=facebook&fb-login=1",
                  data: $(this).serialize(),
                  success: function(msg) {
                  console.log("LOGIN");
                  window.location.reload();
                  }
                })
          var uid = response.authResponse.userID;
          var accessToken = response.authResponse.accessToken;
        }
        else{
          alert('im else');
          FB.login(function(response) {
           if (response.authResponse) {
           console.log('Welcome!  Fetching your information.... ');
           FB.api('/me', function(response) {
             console.log('Good to see you, ' + response.name + '.');
             if(login===false)
             {
               alert('nicht connected');
             }
           });
           } else {
           console.log('User cancelled login or did not fully authorize.');
           }   
         }, {scope: 'email'});
        }});
    });
    // Additional initialization code here
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem with Facebook fan page RSS feed. I need to get
I got a Problem with the Facebook Login on my Website. The Code Below
I couldn't really word the title very well, but here's my problem: I've got
I got the following problem. I want to fully validate our site and we're
Working with the Facebook API makes my ears bleed, but nonetheless I've got a
I got a Facebook php sdk Retrieve friendlist problem. Here is my basic code...
I want to add share this on Facebook to a page. I've got this
I've got some code that does a bunch of set-up, then posts to Facebook
I've got a bit of a problem with a Facebook integration. When my users
I got problem when loading Facebook Javascript SDK, it will causing my SSL connection

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.