code: func (t *UAAAuthentication) refreshToken() error {
  	var expiresIn time.Duration
  
  	tokenStr := strings.TrimPrefix(t.cache.AccessToken(), "bearer ")
  	token, err := jws.ParseJWT([]byte(tokenStr))
  	if err != nil {
  		// if the JWT could not be parsed, force a refresh
  		expiresIn = 0
  	} else {
  		expiration, _ := token.Claims().Expiration()
  		expiresIn = time.Until(expiration)
  	}
  
  	if expiresIn < accessTokenExpirationMargin {
  		tokens, err := t.client.RefreshAccessToken(t.cache.RefreshToken())
  		if err != nil {
  			return err
  		}
  		t.cache.SetAccessToken(tokens.AuthorizationToken())
  		t.cache.SetRefreshToken(tokens.RefreshToken)
  	}
  	return nil
  }
docs: // refreshToken refreshes the JWT access token if it is expired or about to expire.
  // If the access token is not yet expired, no action is performed.