Answer the question
In order to leave comments, you need to log in
What is the correct way to implement "Remember me" for multiple browsers/computers?
The point is this. It would be desirable to remember the User on several computers. Now the cookies have a random string, the database has a string hash. Re-authorization generates a new string. Can anyone suggest "best practices"?
Answer the question
In order to leave comments, you need to log in
Organizing a session object will help you.
In this object, during authorization, you write down a link to the user, remember the authorization data, give the user a key (cookie)
If the user logged in from another computer, then he will have a second session.
You can store it in a database or, for example, in Redis
. Having such objects, you can assign a session lifetime, manage the maximum number of open sessions, and so on.
With each user request, you update the session, recording the date of the request and extending the lifetime of the session.
Here's a thought.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question