diff --git a/package-lock.json b/package-lock.json index 7be6088..8ff5b2d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "lhisp-oauth-client", - "version": "1.0.26", + "version": "1.0.27", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "lhisp-oauth-client", - "version": "1.0.26", + "version": "1.0.27", "license": "MIT", "dependencies": { "axios": "^1.6.1", diff --git a/package.json b/package.json index 31cab23..c7a1e78 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lhisp-oauth-client", - "version": "1.0.26", + "version": "1.0.27", "main": "src/index", "types": "src/index.d.ts", "repository": "git@bitbucket.org:leandro_costa/lhisp-oauth-client.git", diff --git a/src/lhisp-oauth-client.t.ts b/src/lhisp-oauth-client.t.ts index 38e5dfc..df941fe 100644 --- a/src/lhisp-oauth-client.t.ts +++ b/src/lhisp-oauth-client.t.ts @@ -22,6 +22,7 @@ export interface LhispOauthClientConstructorParams { sendAuthCredentialsOnRequestBody?: boolean; formatAccessToken?: (accessToken?: AccessToken) => string; debug?: boolean; + timeout?: number; } export interface ExecutarRequestParams extends AxiosRequestConfig { diff --git a/src/lhisp-oauth-client.ts b/src/lhisp-oauth-client.ts index fd62132..3075eed 100644 --- a/src/lhisp-oauth-client.ts +++ b/src/lhisp-oauth-client.ts @@ -34,6 +34,7 @@ export class LhispOauthClient { protected tokenCreatedAt = 0; protected tokenExpiresIn = 0; protected sendAuthCredentialsOnRequestBody?: boolean; + protected timeout: number; protected formatAccessToken?: (accessToken?: iAccessToken) => string; constructor(params: LhispOauthClientConstructorParams) { @@ -64,6 +65,7 @@ export class LhispOauthClient { this.tokenHeaderName = params.tokenHeaderName || defaultTokenHeaderName; this.sendAuthCredentialsOnRequestBody = params.sendAuthCredentialsOnRequestBody; this.formatAccessToken = params.formatAccessToken; + this.timeout = params.timeout ? params.timeout : 60000; } getAuthHeaderValue(): string { @@ -110,6 +112,7 @@ export class LhispOauthClient { data: { ...this.authData, }, + timeout: this.timeout, }; if (this.grantType) authRequestOpt.data.grant_type = this.grantType; @@ -171,6 +174,7 @@ export class LhispOauthClient { headers, data, params, + timeout: this.timeout, ...opt, });