Skip to content

Commit

Permalink
Logout if token expires (#135)
Browse files Browse the repository at this point in the history
  • Loading branch information
jggoebel authored Oct 26, 2022
1 parent c604786 commit 68bb8dc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/app/header/header.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ export class HeaderComponent implements OnInit {

var tok = this.helper.decodeToken(this.helper.tokenGetter());
this.email = tok.email;

// Automatically logout the user after token expiration
const timeout = tok.exp - Date.now();
setTimeout(() => this.doLogout(), timeout);
}

@ViewChild("logoutmodal", { static: true }) logoutModal: ClrModal;
Expand Down

0 comments on commit 68bb8dc

Please sign in to comment.