T
T
TAnonim2018-07-23 15:22:15
User identification
TAnonim, 2018-07-23 15:22:15

How to implement "remember me" option on multiple devices for one user?

Out of the box, Laravel provides a user remember feature that only works on one device per user (due to the one-to-one correspondence between users and remember_tokens in the database). This entails a rather strange behavior for the user of my site: logged in from a PC-> logged in from a phone-> returned to a PC, but the site has already forgotten it there. It is strange that in such a popular framework as laravel, this point is so poorly implemented.
It would be possible to make a separate remember_tokens table in which to store the user id, token and device id, make a custom guard and provider, but, as far as I understand, so that I can then work with the laravel authentication system (the Auth facade, and other things ), my User model should implement the Authenicatable interface, but in it all methods are sharpened under a single remember_token ...
Maybe I'm overcomplicating everything? What is the correct way to do this?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question