Answer the question
In order to leave comments, you need to log in
How to check and validate authorization tokens on the client side?
Good day, please tell me how to restrict access to pages on the front?
There is a server that sends tokens when the login password is entered correctly.
But how to make exactly access control for these tokens? That is, an authorized user can visit pages, and not an authorized one will be thrown on the authorization form?
Thanks in advance!
Answer the question
In order to leave comments, you need to log in
make the route private (you can google how) on the front, which, every time you try to access it, will check on the back of your token from the front, and the back will send a response like access is allowed or not.
with not / authorized, just check that the token is in cookies or where you store it there, etc. send to the front that the user does not exist and you are already deleting the token from the front simply.
there are many cases.
I hope I explained))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question