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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T00:44:39+00:00 2026-06-08T00:44:39+00:00

My problem is to display a login button and(once the user is logged in)

  • 0

My problem is to display a login button and(once the user is logged in) show his profile image, name and a “logout” link.

In the facebook api documentation (here http://developers.facebook.com/docs/guides/web/#login) i found this example:

 <html>
  <head>
   <title>My Facebook Login Page</title>
  </head>
  <body>

    <div id="fb-root"></div>
    <script>
      window.fbAsyncInit = function() {
        FB.init({
          appId      : 'YOUR_APP_ID', // App ID
          channelUrl : '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel File
          status     : true, // check login status
          cookie     : true, // enable cookies to allow the server to access the session
          xfbml      : true  // parse XFBML
        });
        FB.api('/me', function(user) {
          if (user) {
            var image = document.getElementById('image');
            image.src = 'http://graph.facebook.com/' + user.id + '/picture';
            var name = document.getElementById('name');
            name.innerHTML = user.name
          }
        });
      };
      // Load the SDK Asynchronously
      (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));
    </script>

    <div align="center">
      <img id="image"/>
      <div id="name"></div>
    </div>

  </body>
</html>

That should do what i was looking for. I replaced ‘MY_APP_ID’ and MY_DOMAIN.COM with my app_id and my domain site (http://localhost/index.html). I also added a login button as i found on the documentation (that works and allow me to log in) but then no image nor name is shown. I wrote the “user” object in a console and it conatins this:

error: Object
   code: 2500
   message: "An active access token must be used to query information about the current user."
   type: "OAuthException"

How should I use this “active access token”?

  • 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-08T00:44:41+00:00Added an answer on June 8, 2026 at 12:44 am

    In order to accomplish any user data retrieval, every Facebook application must first authenticate the user session to ensure that the app has the permission of the end user to retrieve their data.

    Reference: https://developers.facebook.com/docs/authentication

    Retrieve their access token with the Javascript SDK and you should be able to begin retrieving their user display name and image as a result.

    Facebook JS SDK: https://github.com/facebook/facebook-js-sdk/

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

Sidebar

Related Questions

<?php //display the bid button if a user is logged in if (isset($_SESSION['username'])) {
I have a webpage that requires login. Once a user has logged in I
Right now I am using an asp.net image button for my login button. I
I am having a problem to display a View. When a button is pressed
I have this problem having to display my jasper report on my grails application.
I have a problem with the display of my popover. After initWithContentViewController: and presentPopoverFromBarButtonItem:permittedArrowDirections:animated:
Problem occured when i tried to display xml data that has been taken by
Problem: The data I'm trying to display is essentially a collection of collections of
The problem I started with is that I want to display in an ASP.NET
I'm having a problem getting a simple ASP.NET webpage to display. The page contains

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.