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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:02:17+00:00 2026-05-31T02:02:17+00:00

Beeing new with the facebook thing. How do you get the user information after

  • 0

Beeing new with the facebook thing. How do you get the user information after the log in?
Here is the code:

 <html>
<head>
  <title>My Facebook Login Page</title>
</head>
<body>
  <div id="fb-root"></div>
  <script>
    window.fbAsyncInit = function() {
      FB.init({
        appId      : 'APP_ID',
        status     : true, 
        cookie     : true,
        xfbml      : true,
        oauth      : true,
      });
    };
    (function(d){
       var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
       js = d.createElement('script'); js.id = id; js.async = true;
       js.src = "//connect.facebook.net/en_US/all.js";
       d.getElementsByTagName('head')[0].appendChild(js);
     }(document));
  </script>
  <p><fb:login-button autologoutlink="true"></fb:login-button></p>
</body>

I red that I have to subscribe to the auth.login event and then use the FB.api… great but how do you do that?

I tried the following:

 <html>
<head>
  <title>My Facebook Login Page</title>
</head>
<body>
  <div id="fb-root"></div>
  <script>
    window.fbAsyncInit = function() {
      FB.init({
        appId      : 'APP_ID',
        status     : true, 
        cookie     : true,
        xfbml      : true,
        oauth      : true,
      });
    };
  FB.auth.login{
        FB.api('/me', function(response) {
          alert(response.name);
        });
      }
    };

    (function(d){
       var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
       js = d.createElement('script'); js.id = id; js.async = true;
       js.src = "//connect.facebook.net/en_US/all.js";
       d.getElementsByTagName('head')[0].appendChild(js);
     }(document));
  </script>
  <p><fb:login-button autologoutlink="true"></fb:login-button></p>
</body>

Thanks for the help. And sorry if I look stupid…

  • 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-05-31T02:02:19+00:00Added an answer on May 31, 2026 at 2:02 am

    Once you initialize the facebook sdk (using FB.init) you can start using it for requests, events, etc.

    The documentation talks about 5 Auth Methods. Which one you need depends on what you want to do and if the user already authorized your application and the permissions you are about to use.

    If the user is not logged in to your application you need to use login method:

    FB.login(function(response) {
        if (response.authResponse) {
            // logged in
        }
        else {
            // not logged in
        }   
    });
    

    If he is already logged in, or you don’t know what his status use getLoginStatus:

    FB.getLoginStatus(function(response) {
        if (response.status === "connected") {
            // the user is logged in and has authenticated your app
            FB.api("/me", function(apiresponse) {
                console.log("api result: ", apiresponse);
            });
        }
        else if (response.status === "not_authorized") {
            // the user is logged in to Facebook, but has not authenticated your app
        }
        else {
            // the user isn't logged in to Facebook.
        }
    });
    

    To make api requests use the api method as in the example I gave you.

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

Sidebar

Related Questions

I'd like to get access to the public information about any user on Facebook.
I am using Facebook PHP SDK to authenticate the user. After generating the LoginUrl
I'm writing a facebook app that iterates through comments. I can get the user
i am creating a facebook application which lets user to upload photo through html
I am fairly new to the Facebook APIs. I want to get a list
My facebook app is being redirected to the canvas url (http://my-domain/app) after the user
I noticed a long time ago (when facebook updated their application after the new
I use Facebook OAuth 2.0 to register new users to my website. After which
I am very new to php, and I am trying to develop a facebook
I wanted to add user search auto-complete (like Facebook's) to my Rails app on

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.