W
W
wergbitsky2020-08-13 08:10:38
JSON Web Token
wergbitsky, 2020-08-13 08:10:38

How to disable user authorization if he is already logged in - JWT in Laravel 7?

Hello! I really need help... The task is this: there is a project on Laravel 7 with JWT authorization. It is necessary to check before authorizing the user whether he is already in the system so that it is impossible to enter, for example, 2 people under the same login / password at the same time ... well, or from 2 browsers (devices) ... So that when trying to log in there is a message like: this user is already in the system... And of course, so that when logout or when the session time expires, it would be possible to re-login...
I would be very grateful!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Anton, 2020-08-13
@wergbitsky

Set a fairly short access token time, when logging in, check in the token table if there are live tokens for another browser. Browsers can be distinguished using cookies or etag.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question