title: How to get get username (or any other data) of the logged in user with React/Redux
body: <p>What would be the best and secure way to store a user logged in data (mainly username or uuid). So, I can use it in my other components? I have thought of several ways to do it.</p>
  
  <ol>
  <li>Upon login/signup, store username in local storage, and remove it when authsession ends. (Very easy to implement, but most likely the least secure)</li>
  <li>Pass email through the AuthLogin/AuthSignup methods, but I can't seem to figure out how to pass it through router. I also notice that this doesn't work if the browser gets refreshed, even if the user is still logged in. </li>
  <li>Cookies (don't know how to use them with react yet). </li>
  </ol>
  
  <p>My authLogin method:</p>
  
  <pre><code>
  export const authLogin = (email, password) =&gt; {
      return dispatch =&gt;{
          dispatch(authStart());
          axios.post('http://127.0.0.1:8000/rest-auth/login/',{
              email: email,
              password: password,
  
          })
          .then(res =&gt; {
              const token = res.data.key;
              const expirationDate = new Date(new Date().getTime() + 3600 * 1000);
              localStorage.setItem('token',token);
              localStorage.setItem('expirationDate',expirationDate)
              localStorage.setItem('email', email)#method 1
              console.log("My token",localStorage.getItem('token'))
              dispatch(authSuccess(token,email));#method 2
              dispatch(checkAuthTimeout(3600));
          })
          .catch(err =&gt; {
              dispatch(authFail(err))
          })
      }
  }
  </code></pre>