0

This problem with fancybox is driving me crazy. When you click the link, the loading icon keeps showing forever and no page is shown. I have tested several things but I have no idea why this happens.

It only happens with a particular kind of page, and it's the one I use to register users with facebook (I use hybridauth internally). They should be asked for authorization in the facebook site, but instead, nothing. But of course, if you open the link normally, without fancybox, it works just fine.

I made a live example of the problem so you can explore it freely. Live test

I really appreciate your help, if you need more info just ask for it. Thank you.

EDIT: Here's the register.php source:

<?php
session_start();

error_reporting(E_ALL);
ini_set('display_errors', 'On');

$config = dirname(__FILE__) . '/hybridauth/hybridauth/Hybrid/config.php';
require_once( "hybridauth/hybridauth/Hybrid/Auth.php" );

try{
    $hybridauth = new Hybrid_Auth( $config );

    switch($_GET["s"]){

        case "facebook":
            $facebook = $hybridauth->authenticate( "Facebook" );
            $facebook_user_profile = $facebook->getUserProfile();

            echo "<pre>";
            print_r( $facebook_user_profile );
            echo "</pre>";
    }

} catch(Exception $e){
    // Display the recived error,
    // to know more please refer to Exceptions handling section on the userguide
    switch( $e->getCode() ){
        case 0 : echo "Unspecified error."; break;
        case 1 : echo "Hybriauth configuration error."; break;
        case 2 : echo "Provider not properly configured."; break;
        case 3 : echo "Unknown or disabled provider."; break;
        case 4 : echo "Missing provider application credentials."; break;
        case 5 : echo "Authentification failed. "
        . "The user has canceled the authentication or the provider refused the connection.";
        break;
        case 6 : echo "User profile request failed. Most likely the user is not connected "
        . "to the provider and he should authenticate again.";
        $twitter->logout();
        break;
        case 7 : echo "User not connected to the provider.";
        $twitter->logout();
        break;
        case 8 : echo "Provider does not support this feature."; break;
    }

    // well, basically your should not display this to the end user, just give him a hint and move on..
    echo "<br /><br /><b>Original error message:</b> " . $e->getMessage();
}
Frildoren
  • 243
  • 3
  • 9
  • 2
    Its `bandsheep.com` not `andsheep.com` right? You are trying to load `andsheep.com`. Check your facebook settings that's causing a redirect. – Naveed Nov 14 '12 at 16:27
  • it would be useful if you publish the php code of register.php to see what is doing after `$_GET['s']` ... also the relevant part of your `.htaccess` because either of them is redirecting to the wrong place when you pass `?s=facebook` (`http://bandsheep.com/sof/register.php?s=test` returns nothing for instance) – JFK Nov 14 '12 at 17:18
  • *facepalm* my fault, I fixed the URL redirect thing. – Frildoren Nov 14 '12 at 22:44

2 Answers2

0

Your register.php is returning:

http://www.andsheep.com/dev/tests/live/BS_tests/hybridauth/hybridauth/?hauth.start=Facebook&hauth.time=1352910122&r=

you also have: dirname(__FILE__) in one line, but not the other.

$config = dirname(__FILE__) . '/hybridauth/hybridauth/Hybrid/config.php';
require_once( "hybridauth/hybridauth/Hybrid/Auth.php" );

Anyway, now I'm getting a .htpasswd login box on the facebook link...

keyboardSmasher
  • 2,661
  • 18
  • 20
0

I think the problem might be that facebook blocks the authentication dialog for iframes.

Frildoren
  • 243
  • 3
  • 9