handleSignedInUser = function(user) {
  // Show redirection notice.
  document.getElementById('redirecting').classList.remove('hidden');
  // Set session cookie
  user.getIdToken().then(function(idToken) {
    // Session login endpoint is queried and the session cookie is set.
    // CSRF token should be sent along with request.
    const csrfToken = getCookie('csrfToken')
    return postIdTokenToSessionLogin('/sessionLogin', idToken, csrfToken)
      .then(function() {
        // Redirect to profile on success.
        window.location.assign('/profile');
      }, function(error) {
        // Refresh page on error.
        // In all cases, client side state should be lost due to in-memory
        // persistence.
        window.location.assign('/');
      });
  });
}
Handles a signed in user. Sets the session cookie and then redirects to
profile page on success.
@param {!firebase.User} user