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 8489653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:53:13+00:00 2026-06-10T21:53:13+00:00

I can’t get this to work, and I have tried every solution that I

  • 0

I can’t get this to work, and I have tried every solution that I have found online. Can someone please look into it and let me know what I am doing wrong.

$(document).ready(function(){
      window.fbAsyncInit = function() {
           FB.init({
                appId: 'xxxxxxx',
                cookie: true,
                xfbml: true,
                oauth: true
           });
           FB.Event.subscribe('auth.login', function(response) {
                window.location.reload();
           });
           FB.Event.subscribe('auth.logout', function(response) {
                window.location.reload();
           });
      };
      (function() {
           var e = document.createElement('script'); e.async = true;
           e.src = document.location.protocol +
           '//connect.facebook.net/en_US/all.js';
           document.getElementById('fb-root').appendChild(e);
      }());

      $("#fb_login_status_check").click(function(){
           FB.getLoginStatus(function(response) {
                           console.log(response);
                if (response.status === 'connected') {
                     // the user is logged in and has authenticated your
                     // app, and response.authResponse supplies
                     // the user's ID, a valid access token, a signed
                     // request, and the time the access token 
                     // and signed request each expire
                     var uid = response.authResponse.userID;
                     var accessToken = response.authResponse.accessToken;
                     console.log('User logged in and autenticated');
                  } else if (response.status === 'not_authorized') {
                     // the user is logged in to Facebook, 
                     // but has not authenticated your app
                     console.log('User logged in, but not autorized');
                  } else {
                     // the user isn't logged in to Facebook.
                     console.log('User not logged in');
                  }
           }, true);


      })

      $("#fb_logout_button").click(function() {
           if(FB.logout(function(response) {
                console.log('User logout.');
           })){
                console.log('User  logout.');
           }else{
           console.log('User didnt logout.');
           }
      });

      $("#fb_login_button").click(function() {
           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 + '.');
                     });
                }else{
                     console.log('User cancelled login or did not fully authorize.');
                }
           }, 
           { 
                scope: 'email,user_likes'
           }); 
      });


      });

Response that I am getting after function is called is

authResponse null
status "unknown"

User is logged in, and I can get all information using php sdk. Please help, I am trying to make this work for the last 2 days…

  • 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-10T21:53:14+00:00Added an answer on June 10, 2026 at 9:53 pm

    You should first initialize this:

    (function() {`   
            var e = document.createElement('script');
            e.async = true;
            e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';   
            document.getElementById('fb-root').appendChild(e);
    }());
    

    It’s the facebook Javascript SDK needed to use those FB functions. And do not forget the ‘fb-root’ element on your page! Just add <div id='fb-root'></div> just after the <body> tag.

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

Sidebar

Related Questions

Can someone please explain why this doesn't work? MyClass myClass1 = new MyClass(); object
Can find why i get this error can someone help? package Android.data; public class
Can someone guide me on a possible solution? I don't want to use /bin/cp
can someone explain why the compiler accepts only this code template<typename L, size_t offset,
Can't figure out how to do this in a pretty way : I have
Can someone help me with this scenario? *There is a button, which when tapped,
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Can somebody help me construct this regular expression, please... Given the following strings... "April
Can anyone tell me why this doesn't work? <?php $lang = $_get[lang]; if (($lang
can anyone tell me why this doesn't work? db = openOrCreateDatabase(database.db, SQLiteDatabase.CREATE_IF_NECESSARY, null); db.setLocale(Locale.getDefault());

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.