9

I am trying to experiment with the new facebook authentication system, and I can't getthe login to work.

I'm getting the following error message:


API Error Code: 100

API Error Description: Invalid parameter

Error Message: next is not owned by the application.


The url that is being sent to facebook is:

http://www.facebook.com/connect/uiserver.php?app_id=444444444444444&next=http%3A%2F%2Fstatic.ak.fbcdn.net%2Fconnect%2Fxd_proxy.php%23%3F%3D%26cb%3Df357eceb0361a8a%26origin%3Dhttp%253A%252F%252Fwww.mysite.com%252Ff38fea4f9ea573%26relation%3Dopener%26transport%3Dpostmessage%26frame%3Df23b800f8a78%26result%3DxxRESULTTOKENxx&display=popup&channel=http%3A%2F%2Fwww.mysite.com%2Ffbtester.php&cancel=http%3A%2F%2Fstatic.ak.fbcdn.net%2Fconnect%2Fxd_proxy.php%23%3F%3D%26cb%3Df6095a98598be8%26origin%3Dhttp%253A%252F%252Fwww.mysite.com%252Ff38fea4f9ea573%26relation%3Dopener%26transport%3Dpostmessage%26frame%3Df23b800f8a78%26result%3DxxRESULTTOKENxx&locale=en_US&return_session=1&session_version=3&fbconnect=1&canvas=0&legacy_return=1&method=permissions.request

Note that the 'Next' variable in the url is:

next=http%3A%2F%2Fstatic.ak.fbcdn.net%2Fconnect%2Fxd_proxy.php%23%3F%3D%26cb%3Df357eceb0361a8a%26origin%3Dhttp%253A%252F%252Fwww.mysite.com%252Ff38fea4f9ea573%26relation%3Dopener%26transport%3Dpostmessage%26frame%3Df23b800f8a78%26result%3DxxRESULTTOKENxx


Any ideas what could be going wrong? All I've done is copy and paste the facebook login demo code from facebook's website:


 <?php
define('FACEBOOK_APP_ID', 'your application id');
define('FACEBOOK_SECRET', 'your application secret');

function get_facebook_cookie($app_id, $application_secret) {
  $args = array();
  parse_str(trim($_COOKIE['fbs_' . $app_id], '\\"'), $args);
  ksort($args);
  $payload = '';
  foreach ($args as $key => $value) {
    if ($key != 'sig') {
      $payload .= $key . '=' . $value;
    }
  }
  if (md5($payload . $application_secret) != $args['sig']) {
    return null;
  }
  return $args;
}

$cookie = get_facebook_cookie(FACEBOOK_APP_ID, FACEBOOK_SECRET);

?>


<!DOCTYPE html>
 <html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:fb="http://www.facebook.com/2008/fbml">
  <body>
    <?php if ($cookie) { ?>
      Your user ID is <?= $cookie['uid'] ?>
    <?php } else { ?>
      <fb:login-button></fb:login-button>
    <?php } ?>

    <div id="fb-root"></div>
    <script src="http://connect.facebook.net/en_US/all.js"></script>
    <script>
      FB.init({appId: '<?= FACEBOOK_APP_ID ?>', status: true,
               cookie: true, xfbml: true});
      FB.Event.subscribe('auth.login', function(response) {
        window.location.reload();
      });
    </script>
  </body>
 </html>

Thanks for the help!

2
  • Please use the correct formatting in your question, this is completely unreadable.
    – Rabbott
    Apr 26, 2010 at 3:05
  • Sorry about that...I've been having some trouble getting it to format correctly..
    – Mark
    Apr 27, 2010 at 2:01

5 Answers 5

5

I was getting the same error, but I am using Rails and the problem was the Connect URL was not updated. My local application is running on port 3000, and the Connect URL was pointing at port 80.

See if changing that works for you.

  1. Goto http://www.facebook.com/developers
  2. Edit the application you are working on
  3. Click the Connect tab on the left
  4. Verify if Connect URL is setup correctly
1
  • For mine, I had left off the 'www' in facebook, but my host auto-forwarded to www... so the urls were different
    – Dusty J
    Oct 16, 2010 at 7:24
1

I don't know much about the Facebook API, but I do know that you have to actually replace the text your application id and your application secret with your application ID and your application secret. :)

1
  • 1
    Hi Nick, Thanks for the response. That's not the problem - I've done that already. I just didn't think it would be appropriate to display my application ID and application secret in this code. I appreciate the help though!
    – Mark
    Apr 27, 2010 at 2:00
1

I had the same problem and couldn't figure it out. It was the base domain as Ji said. I would voted up, but I just joined. Requirements in FB setting pages are so bad... I used localhost.

I also used a querystring of ?nothing=1 for testing b/c of the new requirement where it says: connect url must point to a directory (i.e., end with a "/") or a dynamic page (i.e., have a "?" somewhere.

Therefore, you can't just put default.aspx. You have to end with a slash or have a ? which is a weird requirement for connect.

Thanks Ji!!!

1

I was able to get this solved with these settings:

Base Domain: domain.com (this should also solve adelein's issues with multiple subdomains)

Connect URL: needs to be a valid http:// or https:// URL with a slash at the end OR a '?' somewhere in the URL, signifying a query string. Basically, facebook doesn't want you sending people to static pages which don't properly process the authorization they set up, i guess.

3
  • where do you see those settings? Sep 16, 2010 at 5:27
  • facebook.com/developers/apps.php Click on your application, then "edit settings" Click on "Web Site"
    – jenming
    Sep 22, 2010 at 22:32
  • BUT, it seems they've changed their settings page! Click on "Web Site" - that has domain. But Connect URL seems to have disappeared....
    – jenming
    Sep 22, 2010 at 22:39
0

if connect url is correct, and it still doesn't work, go to your app setting, specify a correct base domain. For testing, you can use localhost. If still no luck, go to migration setting, disable "new data permission"

1
  • Adelein Rodriguez, in your base domain, just specify ddailygirl.com
    – JiJ
    May 3, 2010 at 19:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.