Kaab bin Ujra reported,

The Messenger of Allah ﷺ came out to us when we were nine, five and four, one group from the Arabs and the other from the non-Arabs. He said, "Listen. Have you heard that there will be rulers after me? Whoever goes in to them, affirms their lies, and assists 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 go in to them, does not assist them in their oppression, and does not affirm their lies is of me, and I am of him, and he will come to me at the Pool."

Tirmidhi 2259

Sahih

حدثنا هارون بن إسحق الهمداني حدثني محمد بن عبد الوهاب عن مسعر عن أبي حصين عن الشعبي عن عاصم العدوي

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

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

الترمذي 2259صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami Tirmidhi
Book
Tribulations
Chapter
Warning against agreeing with evil rulers
Numbering
Darussalam 2259
Tirmidhi 2259