Skip to main content

Posts

Showing posts with the label angular 2 auto logout using ng2-idle

Angular 2 - Auto Logout using ng2-idle

Why use Auto Logout in Angular 1 or Angular 2? 1.      A user must be logged out after 10 to 15 minutes (As per you). 2.      Every click interaction must reset the timer. 3.      The timer must be synchronized between tabs and so on. 4.      If users close the tab before your timer expires, he gets logged out when he visits again. Stayed Informed  - Angular 1 auto logout! The below example helps us to handling the “Auto Logout” mechanism to maintain to web applications using “ng2-idle”. import {Component } from '@angular/core' ; import {Idle, DEFAULT_INTERRUPTSOURCES } from 'ng2-idle/core' ; import {Router} from "@angular/router" ; import {Http, Headers} from "@angular/http" ; import {NgClass} from '@angular/common' ; import {Observable} from "rxjs/Observable" ; import 'rxjs/Rx' ; import {HeaderService} from './header.service' ; @ Component({ selector : 'appHeader' ...