Skip to main content

Posts

Showing posts with the label Angular Cookies

Advantages of Token-Based Authentication - Angular 5 and 6

How to set in Angular cookies, type number values? Why is Token Based Authentication more preferable Then Cookie based? The cookie-based authentication has been the default and the cookie-based authentication is stateful. What is Stateful? Keep and track the previously stored information which is used for a current transaction. A stateful service based on HTTP cookies uses the HTTP transport protocol and its ability to convey cookies, used as session context. What are the Cookies Limitations? We can only store around 20 cookies per web server and not more than 4KB of information in each cookie and they can last indefinitely should you choose to specify the max-age attribute. Token Based Authentication - The Token-based authentication has received expansion over last few years due to RESTful Web APIs, SPA and so on. The Token based authentication is stateless. What is Stateless? Every transaction is performed as if it was being done for the very fir...

Angular Cookies methods

What are the cookies methods? Angular cookies concept is very similar to the Angular 1.x but Angular added only one extra method to delete all cookies. The All cookie methods are 1.        Check – This method is used to check the cookie existing or not. 2.        Get - This method returns the value of given cookie name. 3.        GetAll - This method returns a value object with all the cookies 4.        Set – This method is used to set the cookies with a name. 5.        Delete – This method used to delete the cookie with the given name 6.        deleteAll – This method is used to delete all the cookies 7.        and so on    Cookie Methods  – The Angular cookies service contains the following methods. export   declare   class ...