From 2648001bc41a0a7be7b2a06c7d6a13afb72004ce Mon Sep 17 00:00:00 2001 From: Leandro Costa Date: Mon, 27 Nov 2023 19:48:40 -0300 Subject: [PATCH 1/4] feat: add auth data --- src/lhisp-oauth-client.t.ts | 1 + src/lhisp-oauth-client.ts | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lhisp-oauth-client.t.ts b/src/lhisp-oauth-client.t.ts index a4bf572..0fdaf45 100644 --- a/src/lhisp-oauth-client.t.ts +++ b/src/lhisp-oauth-client.t.ts @@ -18,6 +18,7 @@ export interface LhispOauthClientConstructorParams { authHeaders?: Headers; grantType?: string; authContentType?: ContentType; + authData: Record; sendAuthCredentialsOnRequestBody?: boolean; formatAccessToken?: (accessToken?: AccessToken) => string; debug?: boolean; diff --git a/src/lhisp-oauth-client.ts b/src/lhisp-oauth-client.ts index c26024a..2d45b7b 100644 --- a/src/lhisp-oauth-client.ts +++ b/src/lhisp-oauth-client.ts @@ -28,6 +28,7 @@ export class LhispOauthClient { protected authHeaders?: AxiosHeaders; protected grantType?: string; protected agent: https.Agent; + protected authData: Record = {}; protected accessToken?: iAccessToken; protected refreshToken?: iAccessToken; protected tokenCreatedAt = 0; @@ -51,6 +52,7 @@ export class LhispOauthClient { this.certificado = params.certificado; this.headers = (params.headers ? params.headers : {}) as any as AxiosHeaders; this.authHeaders = (params.authHeaders ? params.authHeaders : {}) as any as AxiosHeaders; + this.authData = params.authData; this.apiUrl = params.apiUrl; this.authUrl = params.authUrl; this.authScope = params.authScope; @@ -105,7 +107,9 @@ export class LhispOauthClient { "Content-Type": this.authContentType, ...this.authHeaders, }, - data: {}, + data: { + ...this.authData, + }, }; if (this.grantType) authRequestOpt.data.grant_type = this.grantType; From 28ae4512f4ccda171e18a31096ab133da0d6a2ad Mon Sep 17 00:00:00 2001 From: Leandro Costa Date: Mon, 27 Nov 2023 19:51:14 -0300 Subject: [PATCH 2/4] fix: make authData optional --- src/lhisp-oauth-client.t.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lhisp-oauth-client.t.ts b/src/lhisp-oauth-client.t.ts index 0fdaf45..38e5dfc 100644 --- a/src/lhisp-oauth-client.t.ts +++ b/src/lhisp-oauth-client.t.ts @@ -18,7 +18,7 @@ export interface LhispOauthClientConstructorParams { authHeaders?: Headers; grantType?: string; authContentType?: ContentType; - authData: Record; + authData?: Record; sendAuthCredentialsOnRequestBody?: boolean; formatAccessToken?: (accessToken?: AccessToken) => string; debug?: boolean; From 4408d225dea67b2993927ea0d0a3777c3b3d83bd Mon Sep 17 00:00:00 2001 From: Leandro Costa Date: Mon, 27 Nov 2023 19:53:04 -0300 Subject: [PATCH 3/4] fix: make authData optional --- src/lhisp-oauth-client.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lhisp-oauth-client.ts b/src/lhisp-oauth-client.ts index 2d45b7b..fd62132 100644 --- a/src/lhisp-oauth-client.ts +++ b/src/lhisp-oauth-client.ts @@ -52,7 +52,7 @@ export class LhispOauthClient { this.certificado = params.certificado; this.headers = (params.headers ? params.headers : {}) as any as AxiosHeaders; this.authHeaders = (params.authHeaders ? params.authHeaders : {}) as any as AxiosHeaders; - this.authData = params.authData; + this.authData = params.authData || {}; this.apiUrl = params.apiUrl; this.authUrl = params.authUrl; this.authScope = params.authScope; From a9f83b48ad43f9c9baf74974cef3eb1a593601c9 Mon Sep 17 00:00:00 2001 From: bitbucket-pipelines Date: Mon, 27 Nov 2023 22:53:50 +0000 Subject: [PATCH 4/4] [skip CI] Version 1.0.26 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index e443ee7..7be6088 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "lhisp-oauth-client", - "version": "1.0.25", + "version": "1.0.26", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "lhisp-oauth-client", - "version": "1.0.25", + "version": "1.0.26", "license": "MIT", "dependencies": { "axios": "^1.6.1", diff --git a/package.json b/package.json index 1156f5c..31cab23 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lhisp-oauth-client", - "version": "1.0.25", + "version": "1.0.26", "main": "src/index", "types": "src/index.d.ts", "repository": "git@bitbucket.org:leandro_costa/lhisp-oauth-client.git",