I've found a good flow to manage custom session manage here . The question now is concerning on, which is the best way to store that the user is already validated?
For example I have a rest api that return 0 or 1 if user's creadentials are valid. Now, how and where can I store that information? SessionStorage could be good a place but if I store the user's password encrypted for example, then in controller, I have to check against what?? Where is the true and valid encrypted password?
This question is in general, how to manage user session in angularJS.
EDIT : Maybe the answer could be, you shouldn't check only credentials in the client side?
you have to inject 'ngCookies' in you app module and inject '$cookies' in your controller
and you can put value like $cookies.put('variableName', vlue);
. and you can retrive $cookies.get('variableName');
I've found the solution. Just comment if someone helps.
One of the most important thing is activate credentials in $httpProvider
$httpProvider.defaults.withCredentials = true;
Then in server some cookies must be stored into session and that's all. Next requests now are session-validated.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.