■ give somebody a dose/taste of their own medicine: △to do the same bad thing to someone that they have often done to you, in order to show them how unpleasant it is
- She's always turning up late for me so I thought I'd give her a taste of her own medicine and see how she likes it.
.... Cambridge Idioms Dictionary
■ a taste of one's own medicine (or a dose of one's own medicine)
Fig. a sample of the unpleasantness that one has been giving other people.
(Typically: get ~; have ~; give someone ~.)
- Now you see how it feels to have someone call you names! You are getting a taste of your own medicine!
- John, who is often rude and abrupt with people, was devastated when the teacher treated him rudely. He doesn't like having a dose of his own medicine.
... McGraw-Hill Dictionary of American Idioms and Phrasal Verbs.