commit
b9397ad666
4 changed files with 9 additions and 4 deletions
4
package-lock.json
generated
4
package-lock.json
generated
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "lhisp-oauth-client",
|
"name": "lhisp-oauth-client",
|
||||||
"version": "1.0.25",
|
"version": "1.0.26",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "lhisp-oauth-client",
|
"name": "lhisp-oauth-client",
|
||||||
"version": "1.0.25",
|
"version": "1.0.26",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^1.6.1",
|
"axios": "^1.6.1",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "lhisp-oauth-client",
|
"name": "lhisp-oauth-client",
|
||||||
"version": "1.0.25",
|
"version": "1.0.26",
|
||||||
"main": "src/index",
|
"main": "src/index",
|
||||||
"types": "src/index.d.ts",
|
"types": "src/index.d.ts",
|
||||||
"repository": "git@bitbucket.org:leandro_costa/lhisp-oauth-client.git",
|
"repository": "git@bitbucket.org:leandro_costa/lhisp-oauth-client.git",
|
||||||
|
|
|
@ -18,6 +18,7 @@ export interface LhispOauthClientConstructorParams {
|
||||||
authHeaders?: Headers;
|
authHeaders?: Headers;
|
||||||
grantType?: string;
|
grantType?: string;
|
||||||
authContentType?: ContentType;
|
authContentType?: ContentType;
|
||||||
|
authData?: Record<string, string>;
|
||||||
sendAuthCredentialsOnRequestBody?: boolean;
|
sendAuthCredentialsOnRequestBody?: boolean;
|
||||||
formatAccessToken?: (accessToken?: AccessToken) => string;
|
formatAccessToken?: (accessToken?: AccessToken) => string;
|
||||||
debug?: boolean;
|
debug?: boolean;
|
||||||
|
|
|
@ -28,6 +28,7 @@ export class LhispOauthClient<iAccessToken extends AccessToken = AccessToken> {
|
||||||
protected authHeaders?: AxiosHeaders;
|
protected authHeaders?: AxiosHeaders;
|
||||||
protected grantType?: string;
|
protected grantType?: string;
|
||||||
protected agent: https.Agent;
|
protected agent: https.Agent;
|
||||||
|
protected authData: Record<string, string> = {};
|
||||||
protected accessToken?: iAccessToken;
|
protected accessToken?: iAccessToken;
|
||||||
protected refreshToken?: iAccessToken;
|
protected refreshToken?: iAccessToken;
|
||||||
protected tokenCreatedAt = 0;
|
protected tokenCreatedAt = 0;
|
||||||
|
@ -51,6 +52,7 @@ export class LhispOauthClient<iAccessToken extends AccessToken = AccessToken> {
|
||||||
this.certificado = params.certificado;
|
this.certificado = params.certificado;
|
||||||
this.headers = (params.headers ? params.headers : {}) as any as AxiosHeaders;
|
this.headers = (params.headers ? params.headers : {}) as any as AxiosHeaders;
|
||||||
this.authHeaders = (params.authHeaders ? params.authHeaders : {}) as any as AxiosHeaders;
|
this.authHeaders = (params.authHeaders ? params.authHeaders : {}) as any as AxiosHeaders;
|
||||||
|
this.authData = params.authData || {};
|
||||||
this.apiUrl = params.apiUrl;
|
this.apiUrl = params.apiUrl;
|
||||||
this.authUrl = params.authUrl;
|
this.authUrl = params.authUrl;
|
||||||
this.authScope = params.authScope;
|
this.authScope = params.authScope;
|
||||||
|
@ -105,7 +107,9 @@ export class LhispOauthClient<iAccessToken extends AccessToken = AccessToken> {
|
||||||
"Content-Type": this.authContentType,
|
"Content-Type": this.authContentType,
|
||||||
...this.authHeaders,
|
...this.authHeaders,
|
||||||
},
|
},
|
||||||
data: {},
|
data: {
|
||||||
|
...this.authData,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this.grantType) authRequestOpt.data.grant_type = this.grantType;
|
if (this.grantType) authRequestOpt.data.grant_type = this.grantType;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue