Set manually $session['expires']

Hello,

I have a little question, when a user login with Facebook Connect, I would like him to get a session expire value which never end (or almost never, let say 20 years is fine ;) ), so he will always stays logged in. Does anybody knows how to do that ?

Thank you guys,
Clem

YOu probably want the

YOu probably want the offline_access extended permission.

A facebook session will end when the user logs out of the website or facebook.

But the Facebook session has

But the Facebook session has a lifetime which can be extended as long as I am browsing my drupal site or facebook, but let say I connect and then wait hours before connecting again to the drupal website, I will have to reconnect to Facebook isn't it ?

Anyway, with the offline_access permission (thanks for the suggestion) I can manage to perform my tasks on Facebook without thinking of session expiration.

Now because I don't need to be connected to Facebook (offline_access), I would like to store the fb access_token in the database and simply perform a check on the field to see if I need to use session values or the database access_token.

I will explain my small changes in the code as soon as I get somewhere, but does it seems to people to be a functionality to integrate to the system ?

The best scenario would be :
1. Enable extended permission offline_access in the fb module
2. If offline_access is enabled then store the fb session access_token in the database on creation
3. Check if access_token is filled, if so, perform tasks in offline_access mode.

This way there would not be unnecessary calls to the facebook api, a user would only have to be logged in drupal.
The problem is that I am not sure it would integrate with other fb sub modules.. It may be useful only in my case...

Tell me what you think ;)

Bye,
Clem

fb_user.module tries to store

fb_user.module tries to store this data for you, in the fb_user_app table. (Probably, I will move this functionality to its own module, fb_user_app.module, in the near future).

At any rate, this is not a very will developed component of the modules, but I would like to see it make the use of that table easier. Please do share the code you end up using.

I didn't see the access_token

I didn't see the access_token field in fb_user_app table, so I created it manually. I still have a problem before getting everything working like I need:

Once people log in with Facebook, I don't mind they log out facebook, but I need them to stay logged in drupal website (with offline_access no need for facebook login, I already stored the access_token and session_key).

How can I force fb to:
- OR after allowing my app permissions to logout facebook and stay login in drupal
- OR once facebook session is expired to stay logged in drupal

I simply tried to edit
function _fb_user_logout() {
session_destroy();
$user = drupal_anonymous_user();
}

But I don't have yet a good understanding of the sessions handling. Any idea ?

Thanks for the help ;)
Clem

It's not supposed to work

It's not supposed to work that way. Facebook Connect is like a single sign on between facebook and all connect sites.

That said, you might get it to work that way. I don't know what code you'll have to change. Also I don't recommend it.