diff --git a/src/utils/auth/logout.js b/src/utils/auth/logout.js index 6d765c1b..0d51e6ce 100644 --- a/src/utils/auth/logout.js +++ b/src/utils/auth/logout.js @@ -1,15 +1,21 @@ import { clearAllServiceWorkerCaches } from 'src/utils/caching' import logger from 'src/utils/logger' +import { deleteCookie } from 'cookies-next' import localStorageMgr from 'src/utils/localstorage-mgr' import { STORAGE_KEY_USERNAME } from 'src/utils/constants' const logout = async (AuthUser) => { try { - await AuthUser.signOut() - // Clear the cache so it does not contain any authed content. await clearAllServiceWorkerCaches() await localStorageMgr.removeItem(STORAGE_KEY_USERNAME) + + // Clear cookie for tabV4OptIn + await deleteCookie('tabV4OptIn') + + // Must do this last, as it will cause the page to reload. + await AuthUser.signOut() + return true } catch (e) { logger.error(e)