a taste of their own medicine
US /ə teɪst əv ðɛr oʊn ˈmɛdɪsɪn/
UK /ə teɪst əv ðɛr oʊn ˈmɛdɪsɪn/

1.
experiencing the same unpleasant treatment that one has given to others
:
•
After all the pranks he played, it was time for him to get a taste of his own medicine.
•
She was always criticizing others, so it was ironic when she got a taste of her own medicine.