diff --git a/src/lhisp-oauth-client.t.ts b/src/lhisp-oauth-client.t.ts index 828ec82..288fbe4 100644 --- a/src/lhisp-oauth-client.t.ts +++ b/src/lhisp-oauth-client.t.ts @@ -18,6 +18,7 @@ export interface LhispOauthClientConstructorParams { grantType?: string; authContentType?: ContentType; sendAuthCredentialsOnRequestBody?: boolean; + forceTokenTypeToCamelCase?: boolean; debug?: boolean; } diff --git a/src/lhisp-oauth-client.ts b/src/lhisp-oauth-client.ts index 4f60aef..5e22a1b 100644 --- a/src/lhisp-oauth-client.ts +++ b/src/lhisp-oauth-client.ts @@ -32,6 +32,7 @@ export class LhispOauthClient { protected tokenCreatedAt = 0; protected tokenExpiresIn = 0; protected sendAuthCredentialsOnRequestBody?: boolean; + protected forceTokenTypeToCamelCase?: boolean; constructor(params: LhispOauthClientConstructorParams) { if (params.certificado) { @@ -131,7 +132,10 @@ export class LhispOauthClient { } getAuthToken() { - return `${this.accessToken?.token_type} ${this.accessToken?.access_token}`; + const tokenType = this.forceTokenTypeToCamelCase + ? `${this.accessToken?.token_type?.[0]?.toUpperCase()}${this.accessToken?.token_type?.substring(1)}` + : this.accessToken?.token_type; + return `${tokenType} ${this.accessToken?.access_token}`; } async executarRequest({