title: AWS Identity Token Refreshes But The Refresh Token is lost
body: <p>I am writing a webpage that requires the user to be authenticated when trying to make requests to the server. In order to make sure the user is authenticated (using AWS Cognito) the webpage uses the JWT Token to make requests (in the authorization header). My problem is occurring when the automatic token refresh is running. When the new token is retrieved from the session it appears that the refresh token is being deleted. I have set the session expiration time in AWS to 30 days. Do I have to change a configuration for AWS somewhere in my project to make it aware that is allowed to use the refresh token for more time or is there something else I am missing?</p>
  
  <p>Notes about the project:
  Using Angular2 importing the javascript AWS-Cognito-SDK</p>
  
  <p>Code:</p>
  
  <pre><code>  public getIdToken(): Observable&lt;string&gt; {
      return Observable.create(
        (observer: Observer&lt;string&gt;) =&gt; {
          let cognitoUser = this.getCurrentUser();
          if (cognitoUser != null) {
            cognitoUser.getSession((err, session) =&gt; {
              if (err) {
                observer.error(err);
              } else {
                if (session.isValid()) {
                  observer.next(session.getIdToken().getJwtToken());
                }
              }
            });
          } else {
            observer.error('Failed To Retrieve Id Token');
          }
        });
    };
  
    getUserPool() {
      return new AWSCognito.CognitoIdentityServiceProvider.CognitoUserPool(CognitoUtil._POOL_DATA);
    }
  
    getCurrentUser() {
      return this.getUserPool().getCurrentUser();
    }
  </code></pre>
  
  <p>When trying to get the id token the error message is: </p>
  
  <p>ERROR Error: Missing required parameter REFRESH_TOKEN</p>
  
  <p>steps to reproduce:</p>
  
  <p>1) Log into app</p>
  
  <p>2) Wait for session to expire // 1 hr</p>
  
  <p>3) Refresh Page</p>
  
  <p>4) Wait for session to expire // 1 hr</p>
  
  <p>5) ... Unable to refresh session</p>
  
  <p>This does not occur until after the first refresh, and I have looked into the session and realized that the refreshToken is empty after the call to get the Id Token after the first session refresh</p>