title: Using Session Cookies in React
body: <p>I have a question regarding session cookies in React. </p>
  
  <p>Currently this is how I authenticate a user:</p>
  
  <pre><code>export function loginUser({ email, password }) {
      return function(dispatch) {
          axios.post(`${API_URL}/users/authenticate`, { email, password }, { withCredentials: true })
              .then((response) =&gt; {
                  if (response.data.result_status == "success") {
                      localStorage.setItem("token", JSON.stringify(response.data.user))
                          dispatch({ type: AUTHENTICATE_USER }); 
                          browserHistory.push("/home");
                      })
                  } 
              })
              .catch(() =&gt; {
                  dispatch(authError('Incorrect Login Info'));
              });
      }
  }
  </code></pre>
  
  <p>I send the <code>email</code> and <code>password</code> to a url. If the <code>response.data.result_status == "success"</code>, then I set the user info (like their name and email) to a localStorage token and I call <code>AUTHENTICATE_USER</code> which sets another localStorage item to true. </p>
  
  <p>Since I'm using localStorage, the data persists when I reload. And as long as the authenticated localStorage is not set to null, I stay on the system. </p>
  
  <p>However, now we want to stay on the system as LONG as the cookie's session is not expired. Currently I stay on the system based on the token I set to local storage, not the cookie. </p>
  
  <p>The backend is not using JWT, just a cookie. Is there a way for me to check if the cookie is still in session with axios? </p>