D
D
Delor1th2021-08-11 16:06:42
JavaScript
Delor1th, 2021-08-11 16:06:42

How to properly implement user authorization?

If we imagine that there is some kind of authorization form, thanks to which the user enters and submits a key, which then must be checked for presence in some database, and, in case of successful verification, a response should be returned to the user, allowing access to certain functionality. Moreover, it is necessary to make it so that if one user logged in using the key and got access to the functionality, then another user who wanted to use the same key could not get access. Where can I find information about the implementation of this (creating a database and a server, sending a request to the database and receiving a response, implementing the principle of one key - one user with access to the functionality)?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
writer_2159, 2021-08-12
@writer_2159

Once did something similar.
There is an interface in which the user is authorized. If you open a second tab (in this browser or another computer, it doesn't matter), "there is already an open tab" comes out.
Actually implemented on sockets. when you open a tab after authorization, you send a socket, on the server, you check that such a user does not yet have an open connection, you write down that such a socket id is such a user id.
When you close the tab, you catch a disconnect on the server and overwrite the data about the user id

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question