Merged in development (pull request #18)

Development
This commit is contained in:
Leandro Costa 2024-01-04 17:43:06 +00:00
commit ef8b3d7aba
4 changed files with 8 additions and 3 deletions

4
package-lock.json generated
View file

@ -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",

View file

@ -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",

View file

@ -22,6 +22,7 @@ export interface LhispOauthClientConstructorParams {
sendAuthCredentialsOnRequestBody?: boolean;
formatAccessToken?: (accessToken?: AccessToken) => string;
debug?: boolean;
timeout?: number;
}
export interface ExecutarRequestParams extends AxiosRequestConfig {

View file

@ -34,6 +34,7 @@ export class LhispOauthClient<iAccessToken extends AccessToken = AccessToken> {
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<iAccessToken extends AccessToken = AccessToken> {
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<iAccessToken extends AccessToken = AccessToken> {
data: {
...this.authData,
},
timeout: this.timeout,
};
if (this.grantType) authRequestOpt.data.grant_type = this.grantType;
@ -171,6 +174,7 @@ export class LhispOauthClient<iAccessToken extends AccessToken = AccessToken> {
headers,
data,
params,
timeout: this.timeout,
...opt,
});