dose of one's own medicine
Also, taste of one's own medicine. Repayment or retaliation, as in It's time we gave them a dose of their own medicine and simply forget to call them back , or Joe was upset at being left out, but they were just giving him a taste of his own medicine . [Late 1800s]