i'm using the following modules to test out flash app for facebook, using drupal services:

fb
amfphp
services

when a facebook user visits the application driven by my drupal site, fb automatically creates a local drupal user account mapped to the facebook account. i could call the service function user.login() to have the facebook user login, but that would be redundant since the user is already logged into drupal - however, the user is NOT logged into drupal services.

how do i reconcile drupal and drupal services logins so that the facebook user does not have to needlessly login twice?

Comments

marcingy’s picture

Status: Active » Closed (won't fix)

We don't support any none core drupal technology, might be worth moving the issue to the facebook queue but given that facebook interaction is javascript driven you will likely have to create a custom service.

psi-borg’s picture

Status: Closed (won't fix) » Active

i tried to simply modify the user service without success...


if i have in my facebook template

foreach ( $_SESSION as $ind=>$val )     echo "session: $ind : $val <br />"; 

the session variable fb_sig_user will echo a valid facebook uid. however, 

if i edit services/user_service.inc::user_service_login() at about line 80, replacing 

 $user = user_authenticate(array('name' => $username, 'pass' => $password));

with (yeah this is broken code, point being that $_REQUEST['fb_sig_user'] is not eval'd as TRUE)

if ($_REQUEST['fb_sig_user']){
	  $query = "SELECT uid FROM authmap WHERE authname like '%d\%'";
	  $result = db_query($query, $_REQUEST['fb_sig_user']);
	  $row = db_fetch_object($result);
	  $user = user_laod($row->uid);
	   return services_error(t('inside fb_sig_user block.'));
  }else{
	  $user = user_authenticate(array('name' => $username, 'pass' => $password));
  }

...$_REQUEST['fb_sig_user'] is not evaluated as TRUE and the $user object doesn't get returned.

what am i missing here?

marcingy’s picture

Please do not reopen this issue as I say facebook integration is not supported by the services team.

psi-borg’s picture

idk if you may want to reconsider your last... i would predict that most drupal site accounts will be created/logged into through 3rd party authentication systems, like openID and OAuth, through which users have primary accounts at Google, Yahoo, Facebook or Twitter... and like the big boys, either drupal will adapt to interoperability standards, which (importantly) includes authentication systems... or it will go the way of the dinosaurs and become extinct.

a principal component of the recent success of the behemoths listed above is that they all have services api's and flexibility in how other sites access their services.

marcingy’s picture

If you need this kind of functionality why not create your own login service that provides the ability to integrate with drupal services module. I'm not saying that some sort of support should not be provided but such a module won't live within the services package. The aim is actually to silm down services so as it is only a framework #smallcore if you will. Of course that will take time, as a result we don't want to accept any more crud into the framework.

At the same time I understand your needs to try and find answer to your issue so I'll reopen - another place that you might want to post is on the services group on d.o as that is more general in terms focus whereas we try to make sure tickets that are on the services queue are actually issues that we need to resolve rather than cases that have the potential to go unanswered for ever.

gdd’s picture

Status: Active » Postponed

I do not discount the need for such services, but it is not going to happen in the current branch. I'm not sure if Facebook uses oAuth, but if it does I recommend looking at oauth_common and services_oauth.

I assume we will look more into these features in the next branch, so I'm moving this to postponed for the time being.

gdd’s picture

Status: Postponed » Closed (won't fix)

Hey look, Facebook has moved to oAuth. Won't Fix.

skyredwang’s picture

In your case, there is a session authentication for web+flash, and "key auth" for Drupal services. Is the assumption right? then it is by design your users have to "login twice"

waldmanm’s picture

Just a note for future visitors of this page. There is a bug in amfphp that manifests itself when used with the fb module and causes system.connect to return false when there's a user logged in (instead of returning the user account info). I posted a patch here: http://drupal.org/node/573854#comment-4150996.

Also, once the above problem is fixed, using system.connect returns the user info fine, including for a user who logged in via Facebook Connect (where the fb module created the local Drupal account and mapped it with the FB user).