× Joomla Facebook Connect support forum

Topic-icon Geting Logged off when calling api

Active Subscriptions:

None
11 years 4 months ago #28540 by Ivan
Hi,

I am using JFBConnect v4.2.3 for Joomla 1.5. When I instanciate the library in my model files i would get logged of facebook but remain sign in joomla
The topic has been locked.
Active Subscriptions:

None
11 years 4 months ago #28563 by Ivan
I found this question www.sourcecoast.com/forums/jfbconnect/jf...alls-with-javascript
Is this supported for Joomla 1.5 JFBconnect component?

How would i do an open graph call using the javascript SDK?
The topic has been locked.
Support Specialist
11 years 4 months ago #28668 by alzander
Ivan,
Sorry for the delay in getting back to this. You've changed the text it looked like since we started looking into this, but I'll answer what's above and some of the other issues you're having.

For the logging off issue, please try to add the following code to the components/com_jfbconnect/libraries/facebook.php file in the 'api' function:
if (!$callAsUser)
            $params['access_token'] = $this->facebookAppId . "|" . $this->facebookSecretKey;
        else if (!$params || (is_array($params) && (!array_key_exists('access_token', $params))))
        {
            // Get the access token for the current user
            $jUser = JFactory::getUser();
            $userMapModel = new JFBConnectModelUserMap();
            $userMapModel->getData($jUser->get('id'));
            $accessToken = $userMapModel->_data->access_token;
            if ($accessToken != '' && $accessToken != null)
                $params['access_token'] = $accessToken;
        }
There (I believe) is already the !callAsUser statement, you need to add the else if portion.

In v4.2.3, we should be saving the access token to the database and that should work. The issue is that Facebook's library will try to refetch the token in certain cases, and AJAX calls seem to be one when we bypass some other stuff.

As for the feedPost Javascript, that should be in your jfbconnect.js file as well. I don't think there's been any changes to that code from 4.2.0 when it was introduced, but you can check our jfbconnect.js file we load on this site (from v4.2.4) and just copy it into your jfbconnect.js file if there are any differences.

Hope that helps, and sorry for the delay. Hopefully that will resolve your token issue, but if now, let us know.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
11 years 4 months ago #28672 by Ivan
Okay,

Thanks this makes it work again. This was the cause for logging off and the reason why both my sites would log off if there was api call. I edited the top because i believe i had done something wrong or made a wrong update to my site and how it worked with jfbconnect.Turns out its because of this. Thanks for the help i appreciate it. Also will there be a new version of the jfbconnect for 1.5
The topic has been locked.
Support Specialist
11 years 4 months ago #28696 by alzander
Fantastic! Glad to hear that got you going, and sorry again for the delay. We ran into the same issue when we were adding Open Graph Actions to JFBConnect since we use Javascript for some of the triggers. I couldn't remember exactly what it was that we did to fix it, which is why it took a bit to get back to you.

As for the new version of JFBConnect for Joomla 1.5, it's coming next week. We originally wanted to get it out this Friday, but that's being pushed back to mid/late next week for extra testing and development. That will bring Open Graph Actions to Joomla 1.5 for everyone and will be the last major release of Facebook integration for Joomla 1.5. We'll still be doing bug-fixes as necessary for that release for some time though, just no major feature development.

Hope that helps, and thanks for all your feedback,
Alex
The topic has been locked.