Everything in history depends on a where and when.
*Forgery and Counter Forgery: The Use of Literary Deceit in Ancient Polemics” by Bart Ehrman might be of interest to you for how early Christians grappled with assigning authorship of the New Testament. Some church fathers were more concerned with the message than the authors, some gospels and writings were rejected based on their early textual analysis.
In general though, ancient Greeks and ancient Chinese (and even generally all ancient cultures I think, I just mention these two because these areas I know a bit more of) didn’t put a primacy on “these ideas came from this person.” It’s not always someone setting out to forge a document, it’s “wow, this is useful and very smart, so Confucius must have written it!”
For example - the Spring and Autumn Annals are a series of fairly terse historical accounts of the dealings of ancient petty Chinese kingdoms - about the era before and around Confucius’s time. It is very doubtful that Confucius wrote them. However, ancient Chinese scholars assigned authorship to him, to the point where every line of the Spring and Autumn Annals must have some sort of meaning. The connotation of a single word can mean that Confucius was trying to disapprove of an action or vice versa. (The interpretation is often very weird too - I read Chinese at an elementary school level but have sorta wiggled my way through some of the Analects in Classical Chinese, so I get it really can be subtle and complicated. I have a lovely beautiful copy of the first full English translation of the Zuo traditions with this interpretation saved for a lovely day.)
Medieval people kept on this tradition too, by accidentally or purposefully writing the wrong names on things. If you have a random medical text, it might as well be Galen. You knew that the ancient authors had a shit ton of lost media out there, why wouldn’t this random play be by Aeschylus?
Alchemy was often a capital offense. The alchemists couldn’t actually turn lead into gold, but they could make coins of other metals look like gold.
It would massively depend on what kind of forgery you would like to prevent.
Since your question has zero details I’m going to answer it in a personal way, the authenticity of the Buddha’s teaching. As the Buddha taught, one of his disciples Ananda was able to memorize them through the repetitive manner that the Buddha framed his speeches. During the first Buddhist council Ananda was the primary monastic responsible for orally reciting the Buddha’s teachings to confirm everyone heard it correctly.
Over the next couple hundred years these oral traditions shifting to a written one while maintaining the same format. Many sutras start with “Thus have I heard” as that is how Ananda recited the teachings during the Buddha’s life and at the first Buddhist council.
When Mahayana Buddhism came into being slowly many new sutras appeared which would include two methods of confirming for their readers their authentic status. One was to being the texts with “Thus have I heard” to call back to the Buddha’s disciple Ananda. It must be true if you can trace it to someone who knew him personally! Two was to self reference the importance and level of the teaching within the text, such as the Heart Sutra describing its own mantra as the highest, and the Lotus Sutra describing the Lotus Sutra as the highest sutra in a very meta manner.
Another method that Mahayana writers and teachings use is to say they’re not from the historical Buddha. The most famous sutra, the heart sutra, is framed as Guanyin, Avalokitesvara, teaching to Sariputra.
So forgeries were prevented by calling on people or beings of religious importance and including the sutras importance and thus authenticity within the text itself.
The advent of western scholarship on Buddhist studies created a crisis especially in East Asian Mahayana schools who began to doubt the authenticity of their own teachers. This first was imported into Japan through their early contact with the West then America in the 19th century. Richard Jaffe’s Seeming Sakyamuni is about these Japanese priests doubting Japanese Buddhism authenticity to the point of traveling all the way to Sri Lanka and Indian where sutra weren’t adding methods of authenticity within the texts.
These western ideas were passed through Japan into China where there was a lesser but similar reaction through figures such as Ouyang Jian wanting to go back to Indian Buddhism.