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, });