title: How to preserve localStorage when redirecting to a new external url
body: <p>I'm facing an issue where I can't save the localStorage across redirects.
  Here is my code:</p>
  
  <pre><code>// Call newSitelogin(). Set response(credentials) to localStorage. Redirect to new url.
  newSitelogin({ uuid, password })
    .then(() =&gt; {
      window.open(process.env.NEW_SITE_URL); // This line clears localStorage.
    })
    .catch(() =&gt; replaceRouteWith('/'));
  </code></pre>
  
  <p>Endpoint to call the api and set the response in localStorage</p>
  
  <pre><code>newSitelogin(payload) {
    return yield put.resolve({
        [RSAA]: {
          endpoint: `/auth/hubv3-login`,
          method: 'POST',
          body: JSON.stringify(payload),
          types: [
            ACTION.LOGIN_REQUEST_PERFORM,
            {
              type: ACTION.LOGIN_REQUEST_SUCCESS,
              payload: (action, state, res) =&gt;
                getJSON(res).then(json =&gt; localStorage.setItem('credentials', JSON.stringify(json))), // setting response to localStorage.
            },
            ACTION.LOGIN_REQUEST_FAILURE,
          ],
        },
    });
  };
  </code></pre>
  
  <p>I can see that the credentials are rightly stored in the localStorage of my application:
  <a href="https://i.stack.imgur.com/jPxae.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jPxae.png" alt="enter image description here"></a></p>
  
  <p>But they are not preserved when i redirect to a new url using <code>window.open(process.env.NEW_SITE_URL)</code>.</p>
  
  <p><a href="https://i.stack.imgur.com/ja3Df.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ja3Df.png" alt="enter image description here"></a></p>
  
  <p>How do i make sure that the <code>credentials</code> object is carried over when redirecting to a new url?
  I cannot use sessions and cookies due to the logic written in the app that i'm redirecting to. It only looks for <code>credentials</code> in localStorage.</p>