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

Commit

Permalink
feat(baseConfig): change refreshTokenName option value and add `ref…
Browse files Browse the repository at this point in the history
…reshTokenProp` (breaking)

BREAKING CHANGE: `refreshTokenName` option value has been changed from 'refresh_token' to 'token'. The new `refreshTokenProp` option is set to 'refresh_token' by default (a non-breaking change).
  • Loading branch information
Adam Willden authored and doktordirk committed Apr 9, 2016
1 parent 4f98493 commit c8885d7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -348,13 +348,15 @@ autoUpdateToken: true,
clientId: false,
// The property name used when storing the refresh token locally
refreshTokenStorage: 'aurelia_refresh_token',
// The the property from which to get the refresh token after a successful token refresh
refreshTokenProp: 'refresh_token',

// If `refresh_token` is an object:
// ------------------------------------------------------------
// If the property defined by `refreshTokenProp` is an object:
// -----------------------------------------------------------

// This is the property from which to get the token `{ "refresh_token": { "refreshTokenName" : '...' } }`
refreshTokenName: 'refresh_token',
// This allows the refresh token to be a further object deeper `{ "refresh_token": { "refreshTokenRoot" : { "refreshTokenName" : '...' } } }`
// This is the property from which to get the token `{ "refreshTokenProp": { "refreshTokenName" : '...' } }`
refreshTokenName: 'token',
// This allows the refresh token to be a further object deeper `{ "refreshTokenProp": { "refreshTokenRoot" : { "refreshTokenName" : '...' } } }`
refreshTokenRoot: false,


Expand Down
2 changes: 1 addition & 1 deletion src/authentication.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export class Authentication {
}

setRefreshTokenFromResponse(response) {
let refreshToken = response && response.refresh_token;
let refreshToken = response && response[this.config.refreshTokenProp];
let token;

if (refreshToken) {
Expand Down
12 changes: 7 additions & 5 deletions src/baseConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,15 @@ export class BaseConfig {
clientId: false,
// The property name used when storing the refresh token locally
refreshTokenStorage: 'aurelia_refresh_token',
// The the property from which to get the refresh token after a successful token refresh
refreshTokenProp: 'refresh_token',

// If `refresh_token` is an object:
// ------------------------------------------------------------
// If the property defined by `refreshTokenProp` is an object:
// -----------------------------------------------------------

// This is the property from which to get the token `{ "refresh_token": { "refreshTokenName" : '...' } }`
refreshTokenName: 'refresh_token',
// This allows the refresh token to be a further object deeper `{ "refresh_token": { "refreshTokenRoot" : { "refreshTokenName" : '...' } } }`
// This is the property from which to get the token `{ "refreshTokenProp": { "refreshTokenName" : '...' } }`
refreshTokenName: 'token',
// This allows the refresh token to be a further object deeper `{ "refreshTokenProp": { "refreshTokenRoot" : { "refreshTokenName" : '...' } } }`
refreshTokenRoot: false,


Expand Down

0 comments on commit c8885d7

Please sign in to comment.