From St. Thomas's commentary on St. John, chapter 21, Lecture 6:
2656 Now John states that his Gospel is true, and he speaks in the person of the entire Church which received it: "My mouth will utter truth" (Prv 8:7). We should note that although many have written about Catholic truth, there is a difference among them: those who wrote the canonical scriptures, such as the evangelists and apostles and the like, so constantly and firmly affirm this truth that it cannot be doubted. Thus John says, we know that his testimony is true: "If any one is preaching to you a gospel contrary to that which you received, let him be accursed" (Gal 1:9). The reason for this is that only the canonical scriptures are the standard of faith. The others have set forth this truth but in such a way that they do not want to be believed except in those things in which they say what is true.