From be7c530e9487df980f680dfaa73cdcd6ee51cb20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Troiti=C3=B1o?= Date: Mon, 19 Feb 2018 21:37:43 -0300 Subject: [PATCH] feat(authentication): add option to always store all received properties --- src/authentication.js | 4 ++++ src/baseConfig.js | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/authentication.js b/src/authentication.js index ed85521..e3ade1e 100644 --- a/src/authentication.js +++ b/src/authentication.js @@ -83,6 +83,10 @@ export class Authentication { setResponseObject(response: {}) { if (response) { + if (this.config.keepOldResponseProperties){ + var oldResponse = this.getResponseObject(); + response = Object.assign({}, oldResponse, response); + } this.getDataFromResponse(response); this.storage.set(this.config.storageKey, JSON.stringify(response)); diff --git a/src/baseConfig.js b/src/baseConfig.js index add5651..a662f06 100644 --- a/src/baseConfig.js +++ b/src/baseConfig.js @@ -130,6 +130,9 @@ export class BaseConfig { // The property name used to send the existing token when refreshing `{ "refreshTokenSubmitProp": '...' }` refreshTokenSubmitProp = 'refresh_token'; + // Option to always store all received properties. This allows to work with a single refresh_token that was received once and the expiration only is extend + keepOldResponseProperties = false; + // If the property defined by `refreshTokenProp` is an object: // -----------------------------------------------------------