How to restrict T5 model to generate tokens only from the input text?

The research work I am doing has a requirement to make sure that all the tokens generated by T5 model appear in the input text. Perhaps this can be done by setting bad_words_ids in the .generate() function.
Just wondering if there is a better way to do this?