I'm using the simpleSAMLphp module which redirects the user offsite to login and then hits them back to drupal in a logged in state, but for some reason the sessions aren't getting applied. When the user closes the browser it causes the user to be logged out.

But when I login via the drupal login page, the user session persists even if the browser is closed.

  • What function should I look for in the simpleSAMLphp module where it logs the user in?

  • What might I need to know or edit to make a assign a session time to a user?

  • Is the session information stored in the $user variable and can I manipulate it from there? or is it a database edit?

  • It would be useful to see the code you're using to auto login the user. It's probably relevant
    – Clive
    Commented Dec 23, 2014 at 18:01
  • hi clive! actually i just updated the question, its not a module i wrote, but its the simpleSAMLphp module. thanks! Commented Dec 23, 2014 at 18:35

1 Answer 1


There are several modules that can do this for you.

https://www.drupal.org/project/session_cookie_lifetime https://www.drupal.org/project/remember_me https://www.drupal.org/project/persistent_login

I've had some problems with remember me and am still testing the others, but they give you more control over the session lenght.

By default drupals session expire after about 3 weeks, according to

ini_set('session.cookie_lifetime',  2000000);

You should be able to override this variable at database level as well, if you want to.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.