V
V
Vladislav Verbitsky2022-03-11 17:35:31
JavaScript
Vladislav Verbitsky, 2022-03-11 17:35:31

How to implement the issuance of a bearer token without a JS framework? Does this require a server?

How to issue a token to the user when clicking on the button? I use MongoDB as a database, the user enters Id: gmail / phone, password and clicks register, the data is entered into the database, and the user should be given a token for 10 minutes, after the token is updated by clicking on another button (it has no function, except for updating the token ), but I don't understand how to implement it. Do I need a server for this or can I run the html page through a live server?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GlazOtca, 2022-03-13
@GlazOtca

You definitely need a server. You are connecting to the database, which means that without a server, all connection details will be on the client side! Those. any user will be able to connect to your database and create disgrace there.
And if there is a server, then the client sends a request to it, the server connects to the database using private variables (address, login, password), processes the received data and sends a response to the user. Not to mention the verification of data on the server side and saving the session.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question