diff --git a/ui/redux/actions/sync.js b/ui/redux/actions/sync.js index ba312d8eb..a00a29bb7 100644 --- a/ui/redux/actions/sync.js +++ b/ui/redux/actions/sync.js @@ -3,9 +3,10 @@ import { Lbryio } from 'lbryinc'; import { SETTINGS, Lbry, doWalletEncrypt, doWalletDecrypt } from 'lbry-redux'; import { selectGetSyncIsPending, selectSetSyncIsPending, selectSyncIsLocked } from 'redux/selectors/sync'; import { makeSelectClientSetting } from 'redux/selectors/settings'; -import { getSavedPassword } from 'util/saved-passwords'; +import { getSavedPassword, getAuthToken } from 'util/saved-passwords'; import { doAnalyticsTagSync, doHandleSyncComplete } from 'redux/actions/app'; import { selectUserVerifiedEmail } from 'redux/selectors/user'; +import { X_LBRY_AUTH_TOKEN } from 'constants/token'; let syncTimer = null; const SYNC_INTERVAL = 1000 * 60 * 5; // 5 minutes @@ -148,6 +149,17 @@ export function doGetSync(passedPassword, callback) { } } + // @if TARGET='web' + const xAuth = + Lbry.getApiRequestHeaders() && Object.keys(Lbry.getApiRequestHeaders()).includes(X_LBRY_AUTH_TOKEN) + ? Lbry.getApiRequestHeaders()[X_LBRY_AUTH_TOKEN] + : ''; + if (xAuth && xAuth !== getAuthToken()) { + window.location.reload(); + return; + } + // @endif + return (dispatch) => { dispatch({ type: ACTIONS.GET_SYNC_STARTED,