You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I've just implemented this library and I believe there is an issue with clearing the internal cache after logging out. I've added a force clear cache to be able to be cleared on Logout:
diff --git a/node_modules/apollo-link-jwt/lib/index.js b/node_modules/apollo-link-jwt/lib/index.js
index 03e1c12..7928e0b 100644
--- a/node_modules/apollo-link-jwt/lib/index.js
+++ b/node_modules/apollo-link-jwt/lib/index.js
@@ -7,6 +7,17 @@ import { addRefreshTokenToBody } from './add-refresh-token-to-body';
import { isJwtExpired } from './is-jwt-expired';
import { fetchData } from './fetch-data';
+/**
+ * Global cached tokens to prevent an expensive Async lookup on every request
+ */
+let cachedAccessToken = null;
+let cachedRefreshToken = null;
+
+export const forceClearCache = () => {
+ cachedAccessToken = null;
+ cachedRefreshToken = null;
+}
+
export const ApolloLinkJWT = ({
apiUrl,
getTokens,
@@ -15,12 +26,6 @@ export const ApolloLinkJWT = ({
onRefreshComplete,
debugMode = false,
}) => {
- /**
- * Global cached tokens to prevent an expensive Async lookup on every request
- */
- let cachedAccessToken = null;
- let cachedRefreshToken = null;
-
/**
* Resets the internally cached values
*/
The text was updated successfully, but these errors were encountered:
Hello, I've just implemented this library and I believe there is an issue with clearing the internal cache after logging out. I've added a force clear cache to be able to be cleared on Logout:
The text was updated successfully, but these errors were encountered: