feat: add auth data
This commit is contained in:
parent
5d3df07b20
commit
2648001bc4
2 changed files with 6 additions and 1 deletions
|
@ -18,6 +18,7 @@ export interface LhispOauthClientConstructorParams {
|
|||
authHeaders?: Headers;
|
||||
grantType?: string;
|
||||
authContentType?: ContentType;
|
||||
authData: Record<string, string>;
|
||||
sendAuthCredentialsOnRequestBody?: boolean;
|
||||
formatAccessToken?: (accessToken?: AccessToken) => string;
|
||||
debug?: boolean;
|
||||
|
|
|
@ -28,6 +28,7 @@ export class LhispOauthClient<iAccessToken extends AccessToken = AccessToken> {
|
|||
protected authHeaders?: AxiosHeaders;
|
||||
protected grantType?: string;
|
||||
protected agent: https.Agent;
|
||||
protected authData: Record<string, string> = {};
|
||||
protected accessToken?: iAccessToken;
|
||||
protected refreshToken?: iAccessToken;
|
||||
protected tokenCreatedAt = 0;
|
||||
|
@ -51,6 +52,7 @@ export class LhispOauthClient<iAccessToken extends AccessToken = AccessToken> {
|
|||
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<iAccessToken extends AccessToken = AccessToken> {
|
|||
"Content-Type": this.authContentType,
|
||||
...this.authHeaders,
|
||||
},
|
||||
data: {},
|
||||
data: {
|
||||
...this.authData,
|
||||
},
|
||||
};
|
||||
|
||||
if (this.grantType) authRequestOpt.data.grant_type = this.grantType;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue