title: cognitoUser.refreshSession keeps refreshing user login
body: <p>Im trying to refresh the jwt token with cognitoUser.refreshSession, everytime I log in it simply refreshes the login page and asks me to sign in again</p>
  <p>I have written up some code from various examples I have found but still struggle to get it going. If anyone has any suggestions I would welcome them:</p>
  <p>Code as follows:</p>
  <pre class="lang-js prettyprint-override"><code>import axios from 'axios';
  import { Auth } from 'aws-amplify';
  
  const httpClient = axios.create(
    { baseURL: process.env.VUE_APP_API_BASE_URL }
  );
  
  const refreshToken = async function() {
      try {
          const cognitoUser = await Auth.currentAuthenticatedUser();
          const currentSession = await Auth.currentSession();
          cognitoUser.refreshSession(currentSession.refreshToken, (err, session) =&gt; {
              console.log('session', err, session);
              return Auth.user.signInUserSession.idToken.jwtToken
          });
      } catch (e) {
          console.log('Unable to refresh Token', e);
      }
  }
  
  httpClient.interceptors.request.use(
    config =&gt; {
      const idToken = refreshToken()
      config.headers.Authorization = idToken;
      return config
    }, error =&gt; Promise.reject(error))
  
  
  export default httpClient;
  </code></pre>