× Joomla Facebook Connect support forum

Topic-icon Auto Connect when in Facebook Canvas

Active Subscriptions:

None
14 years 4 months ago #2421 by Ivan
Is there any setting in the facebook connect module with login to auto connect when it inside the facebook canvas via iframe?
The topic has been locked.
Support Specialist
14 years 4 months ago #2428 by alzander
We can look into this. We had some auto-login functionality before, but pared it back a little with the 2.5 release because of some confusion and other issues it causes. With auto-login, it can only work if the user has already logged in previously, since we'll need to know their 'Joomla' user to actually log in.

Can you link to your site (or PM it) so we can get an idea of how you have the page set up and are trying to make this work?

Thanks for all your feedback!
The topic has been locked.
Active Subscriptions:

None
14 years 4 months ago #2434 by Ivan
Well what I am basically hoping to achieve is to have the facebook connect module automatically login once you are seeing the site via the facebook canvas. Currently this only works if I am already logged in via facebook then I open up the application on the facebook canvas. If I am not logged it would show the facebook connect button.

I was reading this article at this page: [url:33nbuzir]http://wiki.developers.facebook.com/index.php/Automatic_Authentication[/url:33nbuzir] which talks about authentication but was not sure if your facebook module has the latest php version of the facebook api.

Technical Details
The user ID is passed along to canvas pages as the fb_sig_canvas_user parameter. You can access it from the new version of the PHP client using:

$fb->get_canvas_user();
This parameter will not always appear. If the user has set stronger privacy settings or is redirected from a non-Facebook URL, this parameter will return null. Furthermore, if the user is logged into Facebook and enters your callback URL (for example, <!-- m --><a class="postlink" href="http://yourdomain/facebookapp">http://yourdomain/facebookapp) directly into the browser's address bar, neither the fb_sig_canvas_user nor the fb_sig_friends parameters get POSTed in the request because this is essentially the same as being redirected from a non-Facebook site.

To access the user's friends in an iFrame application, using PHP, you can simply call friends_get( array( "uid" => fb_sig_canvas_user ) ). Or, for an FBML-based application, the friends are sent automatically, in the fb_sig_friends parameter. Either way, client libraries can get the friend ID information by making this call:

$fb->api_client->friends_get();
To access profile pictures and names, you can use FBML or use the users.getInfo method, which will return the profile picture and user name available on the user's public profile.


Can this method be somehow implemented in the login module ?
The topic has been locked.
Support Specialist
14 years 4 months ago #2470 by alzander
Unfortunately, Facebook does not give version numbers for their API (which is royally annoying). The 2.5.x release of JFBConnect is using a very recent one though (as of early November).

I don't know how easy it would be to implement what you're looking for as we don't use the canvas portion of Facebook very much. If you get something up and running, we'd love to hear about it!
The topic has been locked.
Active Subscriptions:

None
14 years 3 months ago #2637 by Ivan
I came by this thread but I am not so sure how this would fit into your module and a guy was stating about doing some of these things below:
well a couple of things&#58;
1) you need to add  xmlns&#58;fb="http&#58;//www.facebook.com/2008/fbml" to html tag for connect
2) if you are using connect from inside the iframe on facebook canvas - you don't need to use a "connect" button,
since the auth logic is a bit different, you can use just a regular button and require session.

there maybe more things but I didn't investigate it further

From this thread [url:356f10f3]http&#58;//forum.developers.facebook.com/viewtopic.php?id=37755[/url:356f10f3]

I probably need just need to know in what sections of the code I need to replace and paste this code below and how to edit the connect button since it seems it should not be used inside iframe canvas.

Can you help out or point out anything else that would be causing the button to show when you are inside the facebook canvas:
The topic has been locked.
Active Subscriptions:

None
14 years 3 months ago #2662 by Ivan
Is there a way in any section of the code to detect if the user is inside the iframe canvas and then automatically create a pseudo user and log him into the site?
The topic has been locked.
Active Subscriptions:

None
14 years 3 months ago #2702 by Ivan
I found out that we can call loginfacebookuser() to autoconnect when in the facebook canvas but then first time users who access the application inside the canvas get a error "mapping not found" this i presume is because the pseudop user isn't created until the connect button is clicked
The topic has been locked.
Active Subscriptions:

None
14 years 3 months ago #2710 by Ivan
In:components.com_jfbconnect/helpers/facebookhelper.php

I added the lines of code below which firt detect if you are in facebook canvas then calls : JFBConnectController::loginFacebookUser(); to automatically logs you in.

However if a new user not authorized/hasn't clicked on connect tries to access your app in facebook canvas I get this error: 0 - Table usermap not supported. File not found.


I believe this is because a pseudo user hasn't been created yet.

function init()
	{
	if (array_key_exists('fb_sig_in_iframe', $_REQUEST)) {
	  // Site loaded through iframe canvas
                require_once (JPATH_ROOT.DS.'components'.DS.'com_jfbconnect'.DS.'controller.php');
          
          self&#58;&#58;addNamespace();             
          self&#58;&#58;initFbApi();
          JFBConnectController&#58;&#58;loginFacebookUser();

         } else {
          // Site loaded through FB Connect
	        self&#58;&#58;addNamespace();
		self&#58;&#58;initFbApi();
		}	
	}
The topic has been locked.