0

I have a problem with authenticating my Facebook APP with a Link generated through the Facebook PHP SKD:

when I click the link, an error appears on facebook (An error occurred. Please try again later.) and I won't get redirected to the "app login page".

https://www.facebook.com/dialog/oauth?redirect_uri=http%3A%2F%2Fxxx.test.net%2Fstart.php&state=8d0ea10xxxxxxx290be6c654f02xxxa&scope=user_likes

This is the code of the index.php:

<?php
  require_once("./fbsdk/facebook.php");
//test.net
  $config = array();
  $config[‘appId’] = '37353621936xxxx'; 
  $config[‘secret’] = 'fd39e0f0861f2bdae4fc79274749xxxx';
  $config[‘fileUpload’] = false; // optional

  $facebook = new Facebook($config);

?>
<!DOCTYPE html>
<html>
<head>
<title>
FB-DEV-TEST
</title>

</head>
<body>


<?php

$params = array(
  'scope' => 'user_likes',
  'redirect_uri' => 'http://xxx.test.net/start.php'
);

$loginUrl = $facebook->getLoginUrl($params);

echo "<a href=\"$loginUrl\">Login</a>";

?>


</body>
</html>

I've already read this post, but I still can't figure out the problem... are there any changes I have to do at the Facebook APP center, before I can login? Thanx for your help & sry, for my bad english! :)

Community
  • 1
  • 1
benni
  • 37
  • 8
  • 1
    Try adding `'show_error' => true` to your parameters – that should give you a more detailed error description. – CBroe Jul 17 '12 at 12:54
  • @CBroe, to what function call exactly? I've never read about *this* parameter? – ifaour Jul 17 '12 at 13:00
  • To your $params array, that you use to build the login URL. https://developers.facebook.com/docs/reference/dialogs/, “Common Dialog Parameters” – CBroe Jul 17 '12 at 13:29

2 Answers2

0

Check if your redirect_url domain matches the "Site URL:" in App settings on developers.facebook.com.

egis
  • 1,404
  • 2
  • 11
  • 24
0

A few checklists that I can think of:

  • Make sure your Facebook app is not in sandbox mode (unless you are already signed in to your Facebook account before clicking on the login link)

  • At https://developers.facebook.com/apps/:
    "Website with Facebook Login" must be checked, but for "Site URL", you can enter any landing URL.

  • Also at https://developers.facebook.com/apps/:
    Make sure that your site domain is entered under App Domains.

Alternatively, you may want to check out Opauth, an authentication framework for PHP that handles these for you.

uzyn
  • 6,625
  • 5
  • 22
  • 41