Skip to main content

Posts

Showing posts with the label Angular 4 Cookie Based Authentication

Angular 4 Cookie Based Authentication

How to set in Angular 4 cookies, type number values? The cookie based authentication has been the default and the cookie based authentication is stateful. Stateful – keep and track of the previously stored information which is used for current transaction. A stateful service based on HTTP cookies uses the HTTP transport protocol and its ability to convey cookies, used as session context. Example1 for Cookies – import { Component , OnInit } from '@angular/core' ; import { CookieService } from 'ngx-cookie-service' ; @ Component ({   selector: 'app-root' ,   templateUrl: './app.component.html' }) export class AppComponent implements OnInit {   cookieValue = 'default' ;   constructor ( private cookieService : CookieService ) { }   ngOnInit (): void {     //set Cookie     //Syntax- set( name: string, value: string, expires?: number | Date, path?: string, domain?: string, ...