Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

facebookconnect-silverstripe


Go to End


21 Posts   7606 Views

Avatar
dacar

Community Member, 173 Posts

15 September 2010 at 1:15am

Hi, i have just installed facebookconnect-silverstripe from github. Installation works fine. I have added the correct values to my _config.php (mysite):

FacebookConnect::set_api_key('????????????????????');
FacebookConnect::set_api_secret('????????????????????');
FacebookConnect::set_app_id('????????????????????');

FacebookConnect::set_create_member(true);
FacebookConnect::set_member_groups('facebook-members');

then i put the following into the template (Page.ss):

<% if CurrentFacebookMember %>
<p>Hi $CurrentFacebookMember.FirstName</p>
<% include ConnectLogout %>
<% else %>
<% include ConnectLogin %>
<% end_if %>

The FB Login-button is shown and the login window will prompt on kick. But nothing happens after the login. The page reloads and the login button is still there. Can anybody give some advice?

Greetings, Carsten.

Avatar
dacar

Community Member, 173 Posts

23 September 2010 at 9:44pm

Hi, unfortunately i still haven't got that one working. I think i have installed the module correctely and added the application on facebook correctely. On press on the facebook login button, the facebook login window promt. After looging in the window closes. But i am not logged into my silverstripe site. Are the any special settings for the facebook aplication?

set_api_key, set_api_secret and set_app_id are set in _config.php

FacebookConnect::set_create_member(true);
FacebookConnect::set_member_groups('facebook-members');

Hope, anybody can help.

Avatar
Willr

Forum Moderator, 5523 Posts

23 September 2010 at 10:55pm

The only way of debugging this I see is to open up the facebook controller and see whats going on. So the file in question is http://github.com/willrossi/facebookconnect-silverstripe/blob/master/code/FacebookConnect.php. Around line 160 in that if you put a Debug::show($session); you should get some information.

You may also want to try putting a Debug::show($e) inside the catch part (line 225) just to see if its throwing any exceptions which would give you a clue as to why its failing.

Avatar
dacar

Community Member, 173 Posts

23 September 2010 at 11:34pm

Edited: 23/09/2010 11:41pm

Hi Willr,

i have put the Debug at line 169. But there is no debug message?

    /**
     * Extends the built in {@link Controller::init()} function to load the 
     * required files for facebook connect.
     */
    public function onBeforeInit() {
        
        $this->facebook = new Facebook(array(
            'appId'  => self::get_app_id(),
            'secret' => self::get_api_secret(),
            'cookie' => true,
        ));
        
        $this->facebookmember = false;
                            
        $session = $this->facebook->getSession();
Debug::show($session); 
        if($session) {
            // the user is logged into Facebook check to see if this member
            // is currently logged into SilverStripe and if so attempt to merge
            // the accounts otherwise create a new member object
            try {

The Debug::show($e); doesn't throw a message, too

                Session::set('logged-in-member-via-faceboook', true);
                    
                    if($groups = self::get_member_groups()) {
                        foreach($groups as $group) {
                            Group::add_to_group_by_code($member, $group);
                        }
                    }
                }
        
                $this->facebookmember = $member;
            } catch (FacebookApiException $e) { Debug::show($e); }
            Debug::show($e); 
        }
        else {

Shouldn't there be a autom. reload after the facebook promt closes?
Is there anything to care of in the facebook aplication settings? I am not sure abaout the integration settings?

Greetings, Carsten.

Attached Files
Avatar
Willr

Forum Moderator, 5523 Posts

24 September 2010 at 4:51pm

No dev message? check you are in dev mode http://doc.silverstripe.org/debugging#dev_mode

Avatar
dacar

Community Member, 173 Posts

24 September 2010 at 8:03pm

Edited: 24/09/2010 8:10pm

Uuups, sorry Willr. Of course it was not. No things become clearer. It seems to be a problem with the SSL Certificate of my shared hosting. Does the facebook connect only work with SSL?

EDIT: Hmm, if i go to facebook.com after i have looged in withe the help of the promted "Facebook-Login-Form", then i can access my facebook site without login. Seems, that the login works but that the Silverstripe Site does not recognizes the login???

Debug (FacebookConnect->onBeforeInit() in line 169 of FacebookConnect.php)

    * access_token = 147460175293223|2.3124WqQCAMtG1Ilgflkcjg__.3600.1285318800-1513896489|Aplwc3F9oZRod-kVAre1aDf2khQ
    * base_domain = flavourtripping.de
    * expires = 1285318800
    * secret = G1biyPLkq1Ons5RYuVftPA__
    * session_key = 2.3124WqQCAMtG1Ilgflkcjg__.3600.1285318800-1513896489
    * sig = 502819f0872fc1cbeb1d7bd89de4a4aa
    * uid = 1513896489



Debug (FacebookConnect->onBeforeInit() in line 223 of FacebookConnect.php)

FacebookApiException::__set_state(array( 'result' => array ( 
	'error_code' => 60, 
    'error' => array ( 
		'message' => 'SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed', 
        'type' => 'CurlException', ), 
       ), 

	'message' => 'SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL 
routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed', 
	'string' => '', 
    'code' => 60, 
    'file' => '/home/www/22/42/cwflade549/facebookconnect/code/client/Facebook.php', 
    'line' => 511, 
    'trace' => array ( 0 => array ( 
        'file' => '/home/www/22/42/cwflade549/facebookconnect/code/client/Facebook.php', 
        'line' => 487, 
        'function' => 'makeRequest', 
        'class' => 'Facebook', 
        'type' => '->', 
        'args' => array ( 
        0 => 'https://graph.facebook.com/me', 
        1 => array ( 'method' => 'GET', 'access_token' => '147460175293223|2.3124WqQCAMtG1Ilgflkcjg__.3600.1285318800-1513896489|Aplwc3F9oZRod-kVAre1aDf2khQ', ), ), ), 
        1 => array ( 
            'file' => '/home/www/22/42/cwflade549/facebookconnect/code/client/Facebook.php', 
            'line' => 449, 
            'function' => '_oauthRequest', 
            'class' => 'Facebook', 
            'type' => '->', 
            'args' => array ( 
                0 => 'https://graph.facebook.com/me', 
                1 => array ( 'method' => 'GET', ), ), ), 
                2 => array ( 
                    'function' => '_graph', 
                    'class' => 'Facebook', 
                    'type' => '->', 
                    'args' => array ( 
                        0 => '/me', ), ), 
                3 => array ( 
                    'file' => '/home/www/22/42/cwflade549/facebookconnect/code/client/Facebook.php', 
                    'line' => 402, 
                    'function' => 'call_user_func_array', 
                    'args' => array ( 
                        0 => array ( 
                            0 => 
                                Facebook::__set_state(array( 
                                    'appId' => '147460175293223', 
                                    'apiSecret' => '!!!!!!!', 
                                    'session' => array ( 
                                        'access_token' => '147460175293223|2.3124WqQCAMtG1Ilgflkcjg__.3600.1285318800-1513896489|Aplwc3F9oZRod-kVAre1aDf2khQ', 
                                        'base_domain' => 'flavourtripping.de', 
                                        'expires' => '1285318800', 
                                        'secret' => 'G1biyPLkq1Ons5RYuVftPA__', 
                                        'session_key' => '2.3124WqQCAMtG1Ilgflkcjg__.3600.1285318800-1513896489', 
                                        'sig' => '502819f0872fc1cbeb1d7bd89de4a4aa', 
                                        'uid' => '1513896489', ), 
                                        'sessionLoaded' => true, 
                                        'cookieSupport' => true, 
                                        'baseDomain' => '', )), 
                             1 => '_graph', ), 
                        1 => array ( 
                            0 => '/me', ), ), ), 
                4 => array ( 
                    'file' => '/home/www/22/42/cwflade549/facebookconnect/code/FacebookConnect.php', 
                    'line' => 175, 
                    'function' => 'api', 
                    'class' => 'Facebook', 
                    'type' => '->', 
                    'args' => array ( 
                        0 => '/me', ),
                    'type' => '->', 'args' => array ( 
                        0 => NULL, 
                        1 => NULL, 
                        2 => NULL, 
                        3 => NULL, 
                        4 => NULL, 
                        5 => NULL, 
                        6 => NULL, ), ), 
                 6 => array ( 
                        'file' => '/home/www/22/42/cwflade549/sapphire/core/control/Controller.php', 
                        'line' => 132, 
                        'function' => 'extend', 
                        'class' => 'Object', 
                        'type' => '->', 
                        'args' => array ( 
                            0 => 'onBeforeInit', ), ), 
                 7 => array ( 
                    'file' => '/home/www/22/42/cwflade549/sapphire/core/control/Director.php', 
                    'line' => 281, 
                    'function' => 'handleRequest', 
                    'class' => 'Controller', 
                    'type' => '->', 'args' => array ( 
                        0 => SS_HTTPRequest::__set_state(array( 
                            'url' => 'Security/login', 
                            'dirParts' => array ( 
                                0 => 'login', ), 
                            'extension' => NULL, 
                            'httpMethod' => 'GET', 
                            'getVars' => array ( 
                                'url' => '/Security/login', 'BackURL' => '/', ), 
                                'postVars' => array ( ), 
                                'headers' => array ( 'Accept' => 'text/html,text/html,application/xml;q=0.9,*/*;q=0.8', ), 
                                'body' => '', 
                                'allParams' => array ( 
                                    'Action' => 'login', 
                                    'ID' => NULL, 
                                    'OtherID' => NULL, ), 
                                'latestParams' => array ( 
                                    'Action' => 'login', 
                                    'ID' => NULL, 
                                    'OtherID' => NULL, ), 
                                'unshiftedButParsedParts' => 3, )), ), ), 
                  8 => array ( 
                    'file' => '/home/www/22/42/cwflade549/sapphire/core/control/Director.php', 
                    'line' => 124, 
                    'function' => 'handleRequest', 
                    'class' => 'Director', 
                    'type' => '::', 
                    'args' => array ( 
                        0 => SS_HTTPRequest::__set_state(array( 
                            'url' => 'Security/login', 
                            'dirParts' => array ( 0 => 'login', ), 
                            'extension' => NULL, 
                            'httpMethod' => 'GET', 
                            'getVars' => array ( 
                                'url' => '/Security/login', 
                                'BackURL' => '/', ), 
                            'postVars' => array ( ), 
                            'headers' => array ( 
                                'Accept' => 'text/html,text/html,application/xml;q=0.9,*/*;q=0.8', ), 
                                'body' => '', 
                                'allParams' => array ( 
                                    'Action' => 'login', 
                                    'ID' => NULL, 
                                    'OtherID' => NULL, ), 
                                'latestParams' => array ( 
                                    'Action' => 'login', 
                                    'ID' => NULL, 
                                    'OtherID' => NULL, ), 
                                'unshiftedButParsedParts' => 3, )), 
                    
                        1 => Session::__set_state(array( 
                            'data' => array ( 'SubsiteID' => 0, ), 
                            'changedData' => array ( ), )), ), ), 
                    9 => array ( 
                        'file' => '/home/www/22/42/cwflade549/sapphire/main.php', 
                        'line' => 127, 
                        'function' => 'direct', 
                        'class' => 'Director', 
                        'type' => '::', 
                        'args' => array ( 0 => '/Security/login', ), ), ), ))

Avatar
Willr

Forum Moderator, 5523 Posts

25 September 2010 at 11:02am

I have not tested the module with SSL (only on non-ssl sites) but it sounds from the FacebookApiException debug that the SSL cert is the problem. Perhaps try a search online to see why SSL certs aren't being verified. My experience is limited in that area but it could be a limitation with the SDK.

Avatar
nimeso

Community Member, 17 Posts

5 October 2010 at 12:42pm

Has anyone managed to figure this out at all? Thanks for all your hard work guys

Go to Top