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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:32:54+00:00 2026-06-10T08:32:54+00:00

I have a registration form that uses an old version of the FB API.

  • 0

I have a registration form that uses an old version of the FB API.

I am trying to update it to the current version and am having problems dealing with the response from FB.

After clicking the FB login button and granting permissions (email,publish_stream) I cannot find a way to know that the user has granted access (and not just logged in as an already registered user) and needs to proceed to the next page of the registration form.

The response after a successful permission request is the same as a successful login:

{
    authResponse:
    {
        accessToken:    AAAFEIew...URYo,
        userID:         100003908595992,
        expiresIn:      6014,
        signedRequest:  uhTqZodDn0QUoWAUBuYEKmlaM8zViO0r_fnKONaC4v8.eyJhbGdvcml...k5MiJ9,
    },
    status: connected
}

How can I tell if the login was the result of an already registered user or a new registration?

I am using the javascript SDK.

Code:

<script src="http://connect.facebook.net/en_US/all.js" type="text/javascript"></script>


                <div id="fb-root" style="padding: 0px;"></div>
                <script>
                    window.fbAsyncInit = function() {
                        FB.init({
                            appId      : 'API_KEY',
                            status     : true,
                            channelUrl : '//'+window.location.hostname+'/channel.php',
                            cookie     : true,
                            xfbml      : true,
                            oauth      : true
                        });

                        // listen for and handle auth.statusChange events
                        FB.Event.subscribe('auth.statusChange', function(response) {
                            if (response.authResponse) {
                                // user has auth'd your app and is logged into Facebook
                                alert('logged in!');
                            }
                            else
                            {
                                // user has not auth'd your app, or is not logged into Facebook
                                alert('not logged in!');
                            }
                        });

                    };
                    (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));
  • 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-10T08:32:55+00:00Added an answer on June 10, 2026 at 8:32 am

    I realized that I needed to use the getLoginStatus function in the FB SDK.

    My functioning code is:

    <script>
        window.fbAsyncInit = function() {
            FB.init({
                appId       : '<?php echo HSWI_FB_KEY; ?>',
                status      : true,
                logging     : true,
                channelUrl  : '//'+window.location.hostname+'/channel.php',
                cookie      : true,
                xfbml       : true,
                oauth       : true
            });
    
            FB.Event.subscribe('auth.login', function(response)
            {
                window.location.href    = '/login_script.php';
            });
    
            FB.Event.subscribe('auth.logout', function(response) {
                window.location.reload();
            });
    
            checkLoggedInFB();
    
        };
        (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));
    
        function fbLogin()
        {
            FB.login(
                function(response)
                {
                    if(response.authResponse)
                    {
                        window.location.href    = '/login_script.php';
                    }
                }
            );
        }
    
        function checkLoggedInFB()
        {
            try
            {
                FB.getLoginStatus(
                    function(response)
                    {
                        if(response.status == 'connected')
                        {
                            window.location.href    = '/login_script.php';
                        }
                    }
                );
            }
            catch(e)
            {
                alert('Error checking if logged into FB: '+ e.message);
                return false;
            }
            return true;
        }
    
    </script>
    <style type="text/css">
        .fb-login-button
        {
            margin-top: -15px;
        }
    
        .fb-login-button.fb_iframe_widget.fb_hide_iframes
        {
            display: none;
        }
    </style>
    <div class="fb-login-button" scope="email,publish_stream,user_birthday,user_location,user_about_me">Login</div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have functionality on our registration form that uses an AJAX call to check
I have a registration form that is connected to a database table that uses
I have created a registration system that uses AJAX to process the form so
I have a basic form that I'm using for member registration. I'm using the
I have a registration form that when the user enters in valid registration data
I have a user registration form that has a password and confirm password field.
I have a working PHP registration form that goes through $_POST[] requests to check
I'm working on a simple mobile site that have a registration form for Interest,
I have a registration form that is rendered by the following urlconf -- url(r'^$',
I have a big registration form that I've devided with jquery cycle so you

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.