M
M
mantovpinets2017-10-11 17:38:45
PHP
mantovpinets, 2017-10-11 17:38:45

How to check user authorization in the system?

Good day.
I have a web application that requires user authorization. The web application itself is a set of html pages that use AngularJS and all interaction with the server takes place through it. But how to make the system redirect an unauthorized user to the authorization form if he goes to any page of the application using a direct link? (For example www.vasyapupkin.by/main.html)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Dzyuba, 2017-10-11
@mantovpinets

Maybe I don’t fully understand it, but in theory you can check on each page whether the user has cookies or session data indicating that he was type authorized. If not, redirect via header (location ...)
But this is not accurate!

T
Tema, 2017-10-12
@Tem_ka

The server responds with a 401 (UNAUTHORIZED) response code, after which a redirect to /login

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question