Facebook Configuration

Issue #7 closed
João Joyce created an issue

Hi,

I am new to Anvard and Laravel and am probably doing something wrong when following the readme so excuse me in advance.

When I test the Facebook login I get the following page: "HybridAuth Open Source Social Sign On PHP Library. hybridauth.sourceforge.net/"

I also see the following in the logs: "log.DEBUG: Anvard: attempting login [] []"

Could you help me debug this issue?

Comments (5)

  1. Jon Whittlestone

    If you follow the readme and make sure your database connection is made, the first indication that it's working is if you go to:

    {your-host}/anvard/

    If you have set up your social networks, enabled them with the relevant API keys, you should see a link to the social network. Clicking it, should bring up the auth page.

  2. Neo

    Create a file in app/storage/logs/ and name it hauth_debug_file.txt then Add the following to your

    /config/packages/anvard/hybridauth.php
    
    "debug_mode" => true,
        "debug_file" =>"D:\www\Dev\bp4\app\storage\logs\hauth_debug_file.txt",
    //change this path with yours 
    

    this will dump a lot of good info for debugging in the file, then you can share the file to help solve the problem. So your file would look something like this:

    <?php
    return array(
    
        // 'base_url' => URL::route(Config::get('anvard::routes.login')),
    
        'providers' => array (
    
    
            'Facebook' => array (
                'enabled' => true,
                'keys'    => array ( 'id' => 'yourr-key', 'secret' => 'your-secret' ),
                //'scope'  => Input::get('permission_scope','email, user_about_me, user_birthday, user_hometown, user_likes, user_interests, user_location'),
            ),
    
            'Twitter' => array (
                'enabled' => false,
                'keys'    => array ( 'key' => '', 'secret' => '' )
            ),
    
            'LinkedIn' => array (
                'enabled' => false,
                'keys'    => array ( 'key' => '', 'secret' => '' )
            ),
        ),
        "debug_mode" => true,
        "debug_file" =>"D:\www\Dev\bp4\hauth_debug_file.txt",
    
    );
    
  3. Neo

    I also had to edit Atticmedia/Anvard/Anvard.php around line 230 to

       $attributes['user_id'] = $user->id;
            $profile = new $ProfileModel();
            foreach ($attributes as $key => $v) {
                $profile->$key = $v;
            }
            $profile = $this->applyAdapterProfileToExistingProfile($adapter_profile, $profile);
            return $profile;
    
  4. Steve Birstok
    <?php
    
    class Profile extends Eloquent {
    
            // fix provider error.
        protected $fillable = array('user_id', 'provider');
    
        public function user() {
            return $this->belongsTo('User');
        }
    }
    

    This fixed a "provider" exception when filling the profile.

  5. Log in to comment