@overmap-ai/core 1.0.60-sdk-refactor.15 → 1.0.60-sdk-refactor.17
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/dist/overmap-core.js
CHANGED
|
@@ -15473,22 +15473,20 @@ class JWTService extends BaseAuthService {
|
|
|
15473
15473
|
}
|
|
15474
15474
|
if (!response.access)
|
|
15475
15475
|
throw new Error("Missing access token");
|
|
15476
|
-
|
|
15477
|
-
throw new Error("Missing refresh token");
|
|
15478
|
-
return { accessToken: response.access, refreshToken: response.refresh };
|
|
15476
|
+
return { accessToken: response.access, refreshToken: response.refresh ?? this.getRefreshToken() };
|
|
15479
15477
|
});
|
|
15480
15478
|
}
|
|
15481
15479
|
/**
|
|
15482
15480
|
* Logs the user out
|
|
15483
15481
|
*/
|
|
15484
15482
|
clearAuth() {
|
|
15483
|
+
console.debug(this.constructor.name, "clearing auth;");
|
|
15485
15484
|
this.dispatch(setLoggedIn(false));
|
|
15486
15485
|
this.clearTokens();
|
|
15487
15486
|
this.dispatch(setActiveProjectId(null));
|
|
15488
15487
|
this.dispatch(setActiveWorkspaceId(null));
|
|
15489
15488
|
this.dispatch({ type: RESET_STATE });
|
|
15490
15489
|
this.dispatch({ type: resetStore });
|
|
15491
|
-
console.debug(this.constructor.name, "clearing auth;");
|
|
15492
15490
|
}
|
|
15493
15491
|
/**
|
|
15494
15492
|
* Attempts to renew tokens
|
|
@@ -15498,6 +15496,7 @@ class JWTService extends BaseAuthService {
|
|
|
15498
15496
|
if (!dyingRefreshToken) {
|
|
15499
15497
|
throw new Error("No refresh token found");
|
|
15500
15498
|
}
|
|
15499
|
+
console.debug(this.constructor.name, "renewing tokens");
|
|
15501
15500
|
try {
|
|
15502
15501
|
const tokens = await this._getRenewedTokens(dyingRefreshToken);
|
|
15503
15502
|
if (!tokens) {
|
|
@@ -15528,12 +15527,12 @@ class JWTService extends BaseAuthService {
|
|
|
15528
15527
|
}
|
|
15529
15528
|
getAuthHeader() {
|
|
15530
15529
|
const accessToken = this.getAccessToken();
|
|
15531
|
-
console.debug("getAuthHeader", accessToken);
|
|
15532
15530
|
return `Bearer ${accessToken}`;
|
|
15533
15531
|
}
|
|
15534
15532
|
async prepareAuth() {
|
|
15535
15533
|
if (!this.tokenIsExpiringSoon())
|
|
15536
15534
|
return;
|
|
15535
|
+
console.debug(this.constructor.name, "preparing auth");
|
|
15537
15536
|
try {
|
|
15538
15537
|
await this.renewTokens();
|
|
15539
15538
|
} catch (e) {
|
|
@@ -15570,6 +15569,7 @@ class JWTService extends BaseAuthService {
|
|
|
15570
15569
|
}
|
|
15571
15570
|
async initAuth(payload) {
|
|
15572
15571
|
const uuid = v4();
|
|
15572
|
+
console.debug(this.constructor.name, "Initiating auth");
|
|
15573
15573
|
const promise = this.enqueueRequest({
|
|
15574
15574
|
uuid,
|
|
15575
15575
|
description: "Get token pair",
|