lhisp-oauth-client 1.0.31 → 1.0.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -117,6 +117,10 @@ class LhispOauthClient {
|
|
|
117
117
|
contentType: this.authContentType,
|
|
118
118
|
});
|
|
119
119
|
const resp = yield axios_1.default.request(authRequestOpt);
|
|
120
|
+
if (!(resp === null || resp === void 0 ? void 0 : resp.data)) {
|
|
121
|
+
lhisp_logger_1.default.error({ message: "LhispOauthClient.getAccessToken", resp });
|
|
122
|
+
throw new Error("Resposta inválida ao obter token de acesso.");
|
|
123
|
+
}
|
|
120
124
|
this.accessToken = this.buildAccessToken(resp.data);
|
|
121
125
|
this.tokenCreatedAt = new Date().getTime();
|
|
122
126
|
this.tokenExpiresIn = ((_a = this.accessToken) === null || _a === void 0 ? void 0 : _a.expires_in) || this.tokenCreatedAt + 60000;
|
|
@@ -136,6 +140,9 @@ class LhispOauthClient {
|
|
|
136
140
|
if (this.formatAccessToken) {
|
|
137
141
|
return this.formatAccessToken(this.accessToken);
|
|
138
142
|
}
|
|
143
|
+
if (!this.accessToken) {
|
|
144
|
+
throw new Error("Access Token não disponível.");
|
|
145
|
+
}
|
|
139
146
|
return `${(_a = this.accessToken) === null || _a === void 0 ? void 0 : _a.token_type} ${(_b = this.accessToken) === null || _b === void 0 ? void 0 : _b.access_token}`;
|
|
140
147
|
}
|
|
141
148
|
executarRequest(_a) {
|