11

I am having a problem about sessions, or cookies, I didn't understand the reason.

I log on to my site with Auth::attempt($userdata, false), which means Laravel should not remember my login, but it remembers whether I use true or false in attempt function.

in app/config/session.php, variables are determined as

'lifetime' => 120,

'expire_on_close' => true,

Also, when I log in with Auth::attempt($userdata, true), 'Auth::viaRemember()' function returns false.

Edit: Question solved. Cause of the problem is Chrome. See my answer for detailed information.

4
  • What are the values of $userdata?
    – lozadaOmr
    Aug 4, 2014 at 8:17
  • How do you know it is remebered? You can ccheck it by dd(Auth::viaRemember()) if it returdn false, then you are either not waiting long enough for sessions to expire, our you are using MAMP, it can happen there. Aug 4, 2014 at 8:20
  • @lozadaOmr I don't think they are related. I can login and logout. The problem is in the session.
    – yenerunver
    Aug 4, 2014 at 8:27
  • @delmadord I close my browser and open up again, I'm still logged in. I use XAMMP
    – yenerunver
    Aug 4, 2014 at 8:28

2 Answers 2

11

It is a desired behavior to be logged in after you re-open the browser. You can change this in app/config/session.php by setting

'expire_on_close' => true,
4
  • I tried this, but when I do this, I can't login at all.
    – yenerunver
    Aug 4, 2014 at 8:42
  • Then your problem is definitely somewhere else. What is your sessions lifetime set to? Aug 4, 2014 at 8:51
  • Update your question with details HOW you cannot login, when you change what. Aug 4, 2014 at 10:03
  • Sorry for late response. I edited the question. My problem is still there.
    – yenerunver
    Aug 8, 2014 at 6:54
10

I have solved my own question. It appeared that the problem is Chrome's problem. It continues to work in background, so the cookie values do not disappear. I tried my app with firefox and works perfectly.

For more info: https://code.google.com/p/chromium/issues/detail?id=128513

Your Answer

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

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