diff --git a/src/components/TestToolMenu.tsx b/src/components/TestToolMenu.tsx
index 89f3fbc528ef..783b1f74cec2 100644
--- a/src/components/TestToolMenu.tsx
+++ b/src/components/TestToolMenu.tsx
@@ -111,6 +111,15 @@ function TestToolMenu() {
/>
+ {/* Sends an expired session to the FE and invalidates the session by the same time in the BE. Action is delayed for 15s */}
+
+
+
>
);
diff --git a/src/languages/en.ts b/src/languages/en.ts
index 3d35fed3e0a4..fcb86d091037 100755
--- a/src/languages/en.ts
+++ b/src/languages/en.ts
@@ -1251,6 +1251,8 @@ const translations = {
debugMode: 'Debug mode',
invalidFile: 'Invalid file',
invalidFileDescription: 'The file you are trying to import is not valid. Please try again.',
+ expiredSession: 'Send expired session',
+ expireSessionWithDelay: 'Send with delay',
},
debugConsole: {
saveLog: 'Save log',
diff --git a/src/languages/es.ts b/src/languages/es.ts
index cb7f53424958..47e739cc3e91 100644
--- a/src/languages/es.ts
+++ b/src/languages/es.ts
@@ -1250,6 +1250,8 @@ const translations = {
debugMode: 'Modo depuración',
invalidFile: 'Archivo inválido',
invalidFileDescription: 'El archivo que estás intentando importar no es válido. Por favor, inténtalo de nuevo.',
+ expiredSession: 'Enviar sesión caducada',
+ expireSessionWithDelay: 'Enviar con retraso',
},
debugConsole: {
saveLog: 'Guardar registro',
diff --git a/src/libs/actions/Session/index.ts b/src/libs/actions/Session/index.ts
index f4abde1cfc8c..0bc76e790e4a 100644
--- a/src/libs/actions/Session/index.ts
+++ b/src/libs/actions/Session/index.ts
@@ -776,7 +776,18 @@ function invalidateCredentials() {
function invalidateAuthToken() {
NetworkStore.setAuthToken('pizza');
- Onyx.merge(ONYXKEYS.SESSION, {authToken: 'pizza', encryptedAuthToken: 'pizza', creationDate: new Date().getTime() - CONST.SESSION_EXPIRATION_TIME_MS});
+ Onyx.merge(ONYXKEYS.SESSION, {authToken: 'pizza', encryptedAuthToken: 'pizza'});
+}
+
+/**
+ * Send an expired session to FE and invalidate the session in the BE. Action is delayed for 15s
+ */
+function expireSessionWithDelay() {
+ // expires the session after 15s
+ setTimeout(() => {
+ NetworkStore.setAuthToken('pizza');
+ Onyx.merge(ONYXKEYS.SESSION, {authToken: 'pizza', encryptedAuthToken: 'pizza', creationDate: new Date().getTime() - CONST.SESSION_EXPIRATION_TIME_MS});
+ }, 15000);
}
/**
@@ -1238,6 +1249,7 @@ export {
reauthenticatePusher,
invalidateCredentials,
invalidateAuthToken,
+ expireSessionWithDelay,
isAnonymousUser,
toggleTwoFactorAuth,
validateTwoFactorAuth,