diff --git a/doc/refresh_token.md b/doc/refresh_token.md index 148b88e..97e3be6 100644 --- a/doc/refresh_token.md +++ b/doc/refresh_token.md @@ -25,6 +25,8 @@ autoUpdateToken: true, clientId: false, // The the property from which to get the refresh token after a successful token refresh refreshTokenProp: 'refresh_token', +// The proprety name used to send the existing token when refreshing `{ "refreshTokenSubmitProp": '...' }` +refreshTokenSubmitProp = 'refresh_token'; // If the property defined by `refreshTokenProp` is an object: // ----------------------------------------------------------- diff --git a/src/authService.js b/src/authService.js index d858883..9d21d01 100644 --- a/src/authService.js +++ b/src/authService.js @@ -322,12 +322,13 @@ export class AuthService { } if (this.authentication.updateTokenCallstack.length === 0) { - const content = { + let content = { grant_type: 'refresh_token', - refresh_token: this.authentication.getRefreshToken(), client_id: this.config.clientId ? this.config.clientId : undefined }; + content[this.config.refreshTokenSubmitProp] = this.authentication.getRefreshToken(); + this.client.post(this.config.joinBase(this.config.refreshTokenUrl ? this.config.refreshTokenUrl : this.config.loginUrl), content) diff --git a/src/baseConfig.js b/src/baseConfig.js index 1f0e9d0..9eb0aa1 100644 --- a/src/baseConfig.js +++ b/src/baseConfig.js @@ -120,6 +120,8 @@ export class BaseConfig { clientId = false; // The the property from which to get the refresh token after a successful token refresh. Can also be dotted eg "refreshTokenProp.refreshTokenProp" refreshTokenProp = 'refresh_token'; + // The proprety name used to send the existing token when refreshing `{ "refreshTokenSubmitProp": '...' }` + refreshTokenSubmitProp = 'refresh_token'; // If the property defined by `refreshTokenProp` is an object: // -----------------------------------------------------------