lhisp-oauth-client 1.0.25 → 1.0.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lhisp-oauth-client",
3
- "version": "1.0.25",
3
+ "version": "1.0.26",
4
4
  "main": "src/index",
5
5
  "types": "src/index.d.ts",
6
6
  "repository": "git@bitbucket.org:leandro_costa/lhisp-oauth-client.git",
@@ -18,6 +18,7 @@ export declare class LhispOauthClient<iAccessToken extends AccessToken = AccessT
18
18
  protected authHeaders?: AxiosHeaders;
19
19
  protected grantType?: string;
20
20
  protected agent: https.Agent;
21
+ protected authData: Record<string, string>;
21
22
  protected accessToken?: iAccessToken;
22
23
  protected refreshToken?: iAccessToken;
23
24
  protected tokenCreatedAt: number;
@@ -31,6 +31,7 @@ const lhisp_oauth_client_t_1 = require("./lhisp-oauth-client.t");
31
31
  const lhisp_logger_1 = __importDefault(require("lhisp-logger"));
32
32
  class LhispOauthClient {
33
33
  constructor(params) {
34
+ this.authData = {};
34
35
  this.tokenCreatedAt = 0;
35
36
  this.tokenExpiresIn = 0;
36
37
  if (params.certificado) {
@@ -48,6 +49,7 @@ class LhispOauthClient {
48
49
  this.certificado = params.certificado;
49
50
  this.headers = (params.headers ? params.headers : {});
50
51
  this.authHeaders = (params.authHeaders ? params.authHeaders : {});
52
+ this.authData = params.authData || {};
51
53
  this.apiUrl = params.apiUrl;
52
54
  this.authUrl = params.authUrl;
53
55
  this.authScope = params.authScope;
@@ -96,7 +98,7 @@ class LhispOauthClient {
96
98
  url: this.authUrl,
97
99
  httpsAgent: this.agent,
98
100
  headers: Object.assign({ [this.authHeaderName]: this.getAuthHeaderValue(), "Content-Type": this.authContentType }, this.authHeaders),
99
- data: {},
101
+ data: Object.assign({}, this.authData),
100
102
  };
101
103
  if (this.grantType)
102
104
  authRequestOpt.data.grant_type = this.grantType;
@@ -17,6 +17,7 @@ export interface LhispOauthClientConstructorParams {
17
17
  authHeaders?: Headers;
18
18
  grantType?: string;
19
19
  authContentType?: ContentType;
20
+ authData?: Record<string, string>;
20
21
  sendAuthCredentialsOnRequestBody?: boolean;
21
22
  formatAccessToken?: (accessToken?: AccessToken) => string;
22
23
  debug?: boolean;