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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:35:15+00:00 2026-05-22T19:35:15+00:00

i want to authenticate my facebook profile with my website so i can pull

  • 0

i want to authenticate my facebook profile with my website so i can pull infor from the page.
i was suggested to one time authenticate with the facebook api through a temp page. somewhat like:

<fb:login-button params="some permission" />

i am new to coding facebook apps. but this seems like fbml. how can i use it to authenticate my website with my own profile. i dont need users to log into my website. i just need to pull info from my page.

the facebook documentation is sparse and fragmented. all i got for the Login was this code fragment. I dont understand how i can authenticate a weblink through this method.

FB.login(function(response) {
  if (response.session) {
    // user successfully logged in
  } else {
    // user cancelled login
  }
});

can anyone throw some light??

  • 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-22T19:35:17+00:00Added an answer on May 22, 2026 at 7:35 pm

    Let’s start from the beggining:

    <html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml" xml:lang="en" lang="en">
    

    It’s required for fbml to work. Next:

    <fb:login-button autologoutlink="true"></fb:login-button>
    <div id="fb-root"></div>  
    

    These two lines create the “facebook login button”, you should place them in your html where you want the button to appear.

    Right before your closing body tag add:

    <script type="text/javascript" src="https://connect.facebook.net/en_US/all.js"></script>
    <script>
        window.fbAsyncInit = function() {
            FB.init({appId: 'YOUR APP ID HERE', status: true, cookie: true, xfbml: true});
    
            FB.Event.subscribe("auth.login", function(response) {
    
                if(response.session) {                      
                          // this is where you handle facebook's response 
                }
    
            });
    
        };
    
    </script>
    

    What you are doing here is first initializing the connection to facebook, with your app id (you need to create an application), and register an “auth.login” event. The auth.login event is triggered every time you click the facebook login button and successfully login to facebook, or facebook auto logins you based on their cookie.

    You can find an explanation of the auth.login and other events here, look at the sidebar at the left, all events are listed.

    The response is JSON formatted and it contains your basic session information:

    {
        status: 'connected',
        session: {
            access_token: '...',
            expires:'...',
            secret:'...',
            session_key:'...',
            sig:'...',
            uid:'...'
        }
    }
    

    You can read more about it here. If your status is indeed “connected” the next most important bit of information is the uid, this is your unique facebook identifier, a public id with which you can send further requests to facebook. What you do with the response is up to you. An obvious choice would be to send it via ajax to a script that logs you in your application.

    To get more info from facebook you need to download the php sdk. To use the sdk:

    <?php
    
    include_once "facebook-sdk-3.0.0/src/facebook.php";
    
    $appID     = "YOUR APP ID";
    $appSecret = "YOUR APP SECRET";
    
    $cookie = "fbs_{$appID}";
    $cookie = isset($_COOKIE[$cookie]) ? trim($_COOKIE[$cookie], '"') : "";
    
    if(empty($cookie)) {
        echo "no facebook cookie";
        die();
    }
    
    parse_str($cookie, $data);
    
    $facebook = new Facebook(array(
      "appId"  => $appID,
      "secret" => $appSecret,
      "cookie" => true           
    ));        
    
    $facebook->setAccessToken($data["access_token"]);
    
    $user = $facebook->getUser();
    
    $profile = $facebook->api("/me");
    
    ?>  
    

    So at first you parse facebook’s cookie which is named “fbs_YOUR_APP_ID” and contains your session information (url encoded). What you actually need is the access_token (a unique identifier of the authenticated session), which was also returned to you in the JSON response object before. Then via the Facebook object you can do and api requests you want.

    Now to have a full authentication mechanism you should create a similar connect script that instead of getting the session information from the cookie it should take them from the response object that is returned when auth.login occurs (possibly via ajax).

    You should read the Authentication workflow document to better understand how facebook connect works.

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

Sidebar

Related Questions

if I want to authenticate a user through facebook is it necessary to get
I want to use facebook graph api to authenticate users on my webapp which
I can authenticate Facebook for desktop application using web browser control. But I want
I want that users can authenticate through their fb account, and i tried their
I have an application in which I want to authenticate a user from a
I started this website last year, along with a facebook page. http://www.facebook.com/textbookcentral I just
Short question is: how can i use graph api oauth redirects mechanism to authenticate
I am having trouble to authenticate users through the Facebook PHP SDK. Basically I
I want to be able to post on users Twitter feed from a Facebook
I have a facebook page with an iframe app. I want it to be

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.