M
M
Maxim2015-04-22 21:40:03
JavaScript
Maxim, 2015-04-22 21:40:03

What logic for saving the user session should be applied in the application?

There are several options. I can't decide at all.
1. When you first visit the site, send a request for the existence of the session and decide whether to send the user to the authorization page?
2. When sending requests from the client, check whether the session of this user exists or not and, again, decide whether to send the user to the authorization page or not.
Share your experience in this subject.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
E
Eugene, 2015-04-23
Antonikhin @STJ

I don't know how to do this in node.js. In java, in a web application, I declare a Listener that responds to absolutely all requests and checks whether the user is logged in (roughly speaking, whether there is a session by JSESSIONID), if not, a redirect to the login page. 6 years of the project - normal flight)

I
IceJOKER, 2015-04-22
@IceJOKER

You can use cookies, they are also available on the client side.
One way or another, on the server, in every place where authorization is needed, there should be a check; dangerously.
The first option is better in my opinion.

K
kostik, 2015-04-25
@kostiknoir

stackoverflow.com/questions/27747974/mean-stack-au...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question