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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:58:38+00:00 2026-06-12T00:58:38+00:00

Trying to pull out simple authentication, gives me endless loop. strangest thing, when using

  • 0

Trying to pull out simple authentication, gives me endless loop.

strangest thing, when using Mixed js and Php api, it works.

    <?Php
//uses the PHP SDK.  Download from https://github.com/facebook/php-sdk
require 'src/facebook.php';


$facebook = new Facebook(array(
  'appId'  => '306597542762982',
  'secret' => '88XXXXXXf1',
));


if(!$facebook->getUser())
    header("location: ".$facebook->getLoginUrl ());

var_dump($facebook->getUser());

The above code gives me endless loop.
BUT! if you removed the header redirection, and I use the js sdk only for the login process, it works.

  • 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-12T00:58:39+00:00Added an answer on June 12, 2026 at 12:58 am

    Before ANYTHING, make sure you have the latest SDK. I’ve seen this behavior using an outdated SDK. And the comment in your code points to a deprecated version. Make sure your code is from https://github.com/facebook/facebook-php-sdk and not from https://github.com/facebook/php-sdk as it says in your comment.

    Also, you are skipping a couple of steps that you can see in the examples from Facebook on github. Try doing it exactly like they are.

    $user = $facebook->getUser();
    if ($user) {
      try {
        // Proceed knowing you have a logged in user who's authenticated.
        $user_profile = $facebook->api('/me');
      } catch (FacebookApiException $e) {
        error_log($e);
        $user = null;
      }
    }
    

    And then

    if (!$user) {
      $loginUrl = $facebook->getLoginUrl();
      header("Location: " . $loginUrl);
    }
    

    I’m still not positive that header will work, so you might also want to try using a javascript redirect:

    echo "<script type='text/javascript'>top.location.href = '$loginUrl';</script>";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to pull some data out of logs on remote machines using awk,
I'm trying to pull an integer out of localStorage with a simple clojurescript app.
I'm trying to pull out the sales totals for quarter 1. I can't seem
I am trying to pull out data from the table I had from the
I'm trying to pull out a list of table names from a MySQL database.
im having some difficulty trying to pull out a specific value from a cookie.
I am trying pull a field out of a string and return it. My
Trying to parse an SQL string and pull out the parameters. Ex: select *
I am trying to do Part of String tagging to pull out the nouns
I'm trying to complete a regular expression that will pull out matches based 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.