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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:34:45+00:00 2026-06-15T07:34:45+00:00

I am having login using facebook functionality in my site. The issue is after

  • 0

I am having login using facebook functionality in my site. The issue is after getting successful authentication the $facebook->getUser() method returning 0, due to this it’s not preceding towards the rest of code. To resolve this issue I modified my APP ID and Secret Key, also I created new APP but still its not working. Also did lot of stuff on google but didn’t got any success.

Following is my code :

public function facebookregisterAction() {
require 'auth/src/facebook.php';

$facebook = new Facebook(array('appId' => 'xxxxxxxxxxxxxxx','secret' => 'xxxxxxxxxxxxxxxxxxxxxxx','cookie' => true));

$session = new Zend_Session_Namespace('user');
$user = $facebook->getUser();

if ($session->islogout != 1) {
       if ($user) {
            try {
                   $user_profile = $facebook->api('/me');                    
                }catch(Exception $e){}
       }
}

Thanks

  • 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-15T07:34:46+00:00Added an answer on June 15, 2026 at 7:34 am

    As a general answer, I found it helpful to start with example.php in the facebook-php-sdk directory.

    In my case my test application’s URL was different than the site URL. The example.php file provided an error message that was useful enough to diagnose and correct the issue.

    It’s also a good example of actual usage.

    With that said, there’s a part that you seem to be missing. The user will have to visit your app’s Facebook login URL before the API will be very useful (beyond fetching public information). To find this URL, try:

    $url = $facebook->getLoginUrl();
    

    You can give the user a link to click, or quietly redirect the user to this URL if you’re requiring a login. A “Hello, World!”-type start would be something like:

    if ($user) {
      $url = $facebook->getLogoutUrl();
      $message = "Click here to log out";
    } else {
      $url = $facebook->getLoginUrl();
      $message = "Click here to log in";
    }
    
    print "<a href=$url>$message</a>";
    

    But you’ll quickly run into something that is covered by the example.php file: the “access token” (like a session ID) isn’t cleared when the user logs out of Facebook. Your application will still see a valid user object, but any API call that hits Facebook will fail.

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

Sidebar

Related Questions

I'm having users login to my site using Facebook. They are sent away from
I'm having issues redirecting to a page on my site after login via facebook.
I am using devise and create login with Facebook using omniauth, but having problem
I'm automating form login in a certain site using the WebBrowser control. Having the
There is a web-site to crawl, with POST-authentication. How can I, having login and
Having an issue with a salesforce login on our site. When the customer fills
I'm using this gem for Facebook authentication in my Rails app. I'm having some
I have a mobile application that I'm using with Facebook connect. I'm having trouble
I'm looking at .Net code which performs a facebook login, using the C#/.Net library
Trying to add Facebook login / registration to a site I'm working on. Been

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.