angular.js - How does Angular prevent users from accessing pages through addresses without logging in?
巴扎黑2017-05-27 17:44:25
0
3
788
For the designed page, you must log in first before you can use the functions on the page. If you are not logged in, is it possible to enter the page directly through the address link?
Verification is performed uniformly at the router location. Before the router jumps, it determines whether you are logged in. If you are not logged in, jump to the login page
If it is an architecture with completely separated front-end and back-end: When the user opens the page for the first time, he first goes to the back-end to obtain the user information (to determine whether to log in); As for the login verification method: Normally, after successful login, a cookie will be stuffed. a session. The browser will automatically bring this cookie every time it sends a request to the backend. Another verification method is a custom token. In other words, requests for front-end and back-end data interaction are all back-end verification cookies or tokens, and do not require front-end verification.
Actually, when entering each page, you should check whether you need to log in and whether you have logged in. If not, jump to the login page.
Verification is performed uniformly at the router location. Before the router jumps, it determines whether you are logged in. If you are not logged in, jump to the login page
If it is an architecture with completely separated front-end and back-end: When the user opens the page for the first time, he first goes to the back-end to obtain the user information (to determine whether to log in);
As for the login verification method: Normally, after successful login, a cookie will be stuffed. a session. The browser will automatically bring this cookie every time it sends a request to the backend. Another verification method is a custom token.
In other words, requests for front-end and back-end data interaction are all back-end verification cookies or tokens, and do not require front-end verification.