Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

core: fix double refresh token requests on page refresh

Abdullah Attac5489e3c4ac9
diff --git a/packages/core/api/sync/index.js b/packages/core/api/sync/index.js
index 2b1843d58..b1be9e534 100644
--- a/packages/core/api/sync/index.js
+++ b/packages/core/api/sync/index.js
@@ -142,7 +142,6 @@ class Sync {
}
})
.withHubProtocol(new MessagePackHubProtocol({ ignoreUndefined: true }))
- .withAutomaticReconnect()
.build();
EV.subscribe(EVENTS.userLoggedOut, async () => {
diff --git a/packages/core/api/token-manager.js b/packages/core/api/token-manager.js
index 2bd41a34f..878c3935c 100644
--- a/packages/core/api/token-manager.js
+++ b/packages/core/api/token-manager.js
@@ -52,7 +52,7 @@ class TokenManager {
const isExpired = renew && this._isTokenExpired(token);
if (this._isTokenRefreshable(token) && (forceRenew || isExpired)) {
await this._refreshToken(forceRenew);
- return await this.getToken();
+ return await this.getToken(false, false);
}
return token;
@@ -94,7 +94,7 @@ class TokenManager {
throw new Error("Token not found.");
}
- const refreshTokenResponse = await await http.post(
+ const refreshTokenResponse = await http.post(
`${constants.AUTH_HOST}${ENDPOINTS.token}`,
{
refresh_token,