Kaab bin Ujra reported,

The Messenger of Allah ﷺ came out to us when we were nine in number and said, "There will come after me rulers. Whoever endorses their lies and supports them in their oppression is not of me, and I am not of him, and he will not come to me at the Pool. But whoever does not endorse their lies and does not support them in their oppression is of me, and I am of him, and he will come to me at the Pool."

Nasai 4212

Sahih

أخبرنا عمرو بن علي قال حدثنا يحيى عن سفيان عن أبي حصين عن الشعبي عن عاصم العدوي

عن كعب بن عجرة قال

خرج علينا رسول الله ﷺ ونحن تسعة فقال إنه ستكون بعدي أمراء من صدقهم بكذبهم وأعانهم على ظلمهم فليس مني ولست منه وليس بوارد علي الحوض ومن لم يصدقهم بكذبهم ولم يعنهم على ظلمهم فهو مني وأنا منه وهو وارد علي الحوض

النسائي 4212صحيح
Contents
Reference
Commentary
Ayat
Collection
Sunan Nasai Sughra
Book
Pledge of allegiance
Chapter
Warning for whoever helps a ruler in oppression
Numbering
Darussalam 4212
Nasai 4212