From Sahih Muslim (Hadith 4799):
It has been narrated on the authority of Aba Sa'id al-Khudri that the Messenger of Allah (ﷺ) said:When oath of allegiance has been taken for two caliphs, kill the one for whom the oath was taken later
Reference: Muslim 4799