From 0ed1f7778e22a9ab126ec86c713465cbeb7edbfe Mon Sep 17 00:00:00 2001 From: Giuseppe Digilio Date: Thu, 5 Apr 2018 14:35:30 +0200 Subject: [PATCH] Set the expire date of the cookie's token to one date --- src/app/core/auth/auth.service.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/app/core/auth/auth.service.ts b/src/app/core/auth/auth.service.ts index 6b9f31ee91..747d168533 100644 --- a/src/app/core/auth/auth.service.ts +++ b/src/app/core/auth/auth.service.ts @@ -252,8 +252,14 @@ export class AuthService { * @returns {AuthTokenInfo} */ public storeToken(token: AuthTokenInfo) { - const expires = new Date(token.expires); + // Add 1 day to the current date + const expireDate = Date.now() + (1000 * 60 * 60 * 24 * 1); + + // Set the cookie expire date + const expires = new Date(expireDate); const options: CookieAttributes = {expires: expires}; + + // Save cookie with the token return this.storage.set(TOKENITEM, token, options); }