Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
feat(authentication): add option to always store all received properties
Browse files Browse the repository at this point in the history
  • Loading branch information
diegotroitino committed Feb 21, 2018
1 parent 0f80003 commit be7c530
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/authentication.js
Expand Up @@ -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));

Expand Down
3 changes: 3 additions & 0 deletions src/baseConfig.js
Expand Up @@ -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:
// -----------------------------------------------------------

Expand Down

0 comments on commit be7c530

Please sign in to comment.