session.isvalid() is always valid amazon incognito

The problem is that even after expiration time that is 5 min for ID token and access token, the session is still validated for some reason I cannot understand. Can someone help me what should I Do?

let cognitoUser = userPool.getCurrentUser();
if (cognitoUser != null) {
  await cognitoUser.getSession((err, session) => {
   if (err) {
    console.error(err.message);
    return;
  }
  console.log('session validity: ' + session.isValid());

I tried waiting for 5 min or more to check if token has expired or not but it still says that it is valid whereas I was expecting it will go to refresh token function.