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

  • Home
  • SEARCH
  • 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 8476215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:07:07+00:00 2026-06-10T18:07:07+00:00

i am using facebook javascript SDK for login button in my website it is

  • 0

i am using facebook javascript SDK for login button in my website it is working properly but i am missing in two use cases

  1. whenever facebook cookie is available it is redirecting from index.php to event.php page even though i am firing FB.login() function on-click event.
  2. when user clicks on logout button on my site i am redirecting it index.php, after loading the index.php page it is again redirecting to event.php page

here is my code in index.php

<script src="//connect.facebook.net/en_US/all.js"></script>
<script>
FB.init({
  appId      : '375834632488230', // App ID
  status     : true, // check login status
  cookie     : true, // enable cookies to allow the server to access the session
  xfbml      : true  // parse XFBML
});
// Additional initialization code here
FB.Event.subscribe('auth.login', function(response) { 
window.location="http://mysite.com/event.php";

});

function doLogin(){
console.log("clicked on fb");
FB.login(function(response) {
  if (response.session) {
  FB.api('/me?fields=email,location,name,first_name,last_name,picture',
   function (response) {       });
  }
} , {scope:'email'}); 
}

</script>
<a href="#" id="fblogin"  class="signinfacebook" onclick="doLogin()">Sign in with
Facebook</a>
  • 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-10T18:07:08+00:00Added an answer on June 10, 2026 at 6:07 pm

    answering my own question

    Remove this code :

    FB.Event.subscribe('auth.login', function(response) { 
        window.location="http://mysite.com/event.php";
    });
    

    This should not be used in this context.

    Then include this line in FB.Login() function :

    if(response.status=='connected'){
        window.location="http://mysite.com/event.php";
    } else {
        console.log("login failed");
    }
    

    i think this should work fine

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the Facebook Javascript SDK to create a login button using the
Here I am using Facebook Login button plugin and javascript sdk I am able
I use the javascript to get some data from facebook using javascript sdk: window.fbAsyncInit
I'm using Facebook's Javascript SDK to allow login/logout, and my problem is that when
I'm in the process of using the facebook javascript sdk to provide user login
Using Javascript SDK for Facebook, you can do a FB.login(function(response) { if (response.authResponse) {
I am using JavaScript SDK of Facebook for signup with Facebook button in my
I am using the JavaScript SDK to login in the user on my website
I'm using the Facebook JavaScript SDK to implement login for my site. I've already
using Facebook Javascript SDK (since FBml doesn't work anymore), posting to a wall using

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.