What is the use of laravel remember me token?
Asked Answered
M

2

7

I have a couple of problems with understanding Laravel remember me functionality.

  1. What is the connection between remember me functionality and remember_me column in users table ?
  2. Is there a timeout for this functionality?

Thank you.

Maller answered 4/6, 2019 at 7:59 Comment(0)
T
6

Laravel authentication offers remember me functionality out of the box.

In order to use it you need to do 2 things:

add remember_token column in your users table - this is where the token will be stored pass true as a second parameter of Auth::attempt() to enable remember me behaviour If you do this, Laravel will generate a token that will be saved in users table and in a cookie. On subsequent requests, even if session cookie is not available, user will be authenticated automatically as long as remember-me cookie is there.

You can find more details and example in the docs: Click Here

Trace answered 4/6, 2019 at 8:4 Comment(0)
V
4

There is a good documentation on this as well here

  1. But yes, there is a connection and that's set when you select the remember me option when you log in.
  2. It lasts indefinitely, so there is no timeout.
Vizza answered 4/6, 2019 at 8:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.