To get a taste of your own medicine
to have the same unpleasant experience that you have inflicted on someone else
my supervisor at work is very bad tempered, constantly shouting at us and criticising our work. Her new boss is just like her so she has been getting a taste of her own medicine.
The idiom comes from one of Aesop’s fables about a swindler who sells fake medicine, claiming that it can cure anything. When he falls ill, people give him his own medicine, which he knows will not work.